summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpitfireX <timm.weber@me.com>2015-08-11 04:18:40 +0200
committerSpitfireX <timm.weber@me.com>2015-08-11 04:18:40 +0200
commit6b7c7479a3fb8afac15a506115b16b247b4c7680 (patch)
tree1d46101670a34225b200ef989c1972622414b764
parent94755002835bfdf9b4990b797b8ead3acacaad71 (diff)
Some minor changes
- increased the detection radius for possible threats - removed some unnecessary conditions which lead to some buggy behavior - changed the default resolution (again... maybe it's better)
-rw-r--r--gui.py2
-rw-r--r--main.py12
2 files changed, 7 insertions, 7 deletions
diff --git a/gui.py b/gui.py
index 800abc4..6e46e73 100644
--- a/gui.py
+++ b/gui.py
@@ -22,7 +22,7 @@ logging = False
input = False
clock = pygame.time.Clock()
-screensize=(1280, 720)
+screensize=(1280, 800)
screen=pygame.display.set_mode(screensize,HWSURFACE|DOUBLEBUF|RESIZABLE)
def draw_line(p1, p2, color, global_coords=True):
diff --git a/main.py b/main.py
index 583581b..ba21071 100644
--- a/main.py
+++ b/main.py
@@ -56,7 +56,7 @@ while True:
relpos = ((cell.pos[0]-c.player.center[0]),(cell.pos[1]-c.player.center[1]))
dist = math.sqrt(relpos[0]**2+relpos[1]**2)
- if (not cell.is_virus and dist < 300+2*cell.size and cell.mass > 1.25 * my_smallest) or (cell.is_virus and dist < cell.size and cell.mass < my_largest):
+ if (not cell.is_virus and dist < 500+2*cell.size and cell.mass > 1.25 * my_smallest) or (cell.is_virus and dist < cell.size and cell.mass < my_largest):
angle = math.atan2(relpos[1],relpos[0])
corridor_width = 2 * math.asin(cell.size / dist)
forbidden_intervals += canonicalize_angle_interval((angle-corridor_width, angle+corridor_width))
@@ -85,15 +85,15 @@ while True:
target = (runaway_x, runaway_y)
has_target = False
+ target_cell = None
color = (255,0,0)
print ("Running away: " + str((runaway_x-c.player.center[0], runaway_y-c.player.center[1])))
else:
- if target_cell != None:
- if target_cell not in c.world.cells.values():
- target_cell = None
- has_target = False
- print("target_cell does not exist any more")
+ if target_cell not in c.world.cells.values():
+ target_cell = None
+ has_target = False
+ print("target_cell does not exist any more")
elif target == tuple(c.player.center):
has_target = False
print("Reached random destination")