|
11 | 11 | #pygame variables
|
12 | 12 | TITLE = "FLOCKING"
|
13 | 13 | BACKGROUND = (0,0,0)
|
14 |
| -AGENT_COLOR = [(116,175,173),(222,27,26)] |
| 14 | +AGENT_COLOR = [(116,175,173),(222,27,26)] # [agent 1, agent 2] |
15 | 15 | OBSTACLE_COLOR = (250,250,250)
|
16 | 16 | TEXT_COLOR = (255,255,255)
|
17 |
| -TRI_BASE = [12,10,] |
18 |
| -TRI_HEIGHT = [18,15] |
| 17 | +TRI_BASE = [12,10] # [agent 1, agent 2] |
| 18 | +TRI_HEIGHT = [18,15] # [agent 1, agent 2] |
19 | 19 | MAX_AGENT_COUNT = 60
|
20 | 20 |
|
21 | 21 | #Initialize Display
|
|
25 | 25 | screen = pyg.display.set_mode((shared.WIDTH, shared.HEIGHT))
|
26 | 26 | pyg.display.set_caption(TITLE)
|
27 | 27 |
|
28 |
| - |
29 | 28 | def make_agent_inbound():
|
30 | 29 | for agent in shared.agent_array:
|
31 | 30 | agent.pos = agent.pos[0] % shared.WIDTH, agent.pos[1] % shared.HEIGHT
|
@@ -65,7 +64,8 @@ def draw_agent():
|
65 | 64 |
|
66 | 65 | def draw_obstacle():
|
67 | 66 | for obs in shared.obstacle_array:
|
68 |
| - pyg.draw.rect(screen, OBSTACLE_COLOR, (obs.pos[0], obs.pos[1], obs.radius, obs.radius), 0) |
| 67 | + width = obs.width |
| 68 | + pyg.draw.rect(screen, OBSTACLE_COLOR, (obs.pos[0] - width/2, obs.pos[1] - width/2, width, width), 0) |
69 | 69 |
|
70 | 70 | def run():
|
71 | 71 | #game loop
|
|
0 commit comments