diff options
author | SpitfireX <timm.weber@me.com> | 2015-08-11 05:59:04 +0200 |
---|---|---|
committer | SpitfireX <timm.weber@me.com> | 2015-08-11 05:59:04 +0200 |
commit | 804cf4d8145a53722739b4cad8dbbacdf0bf166c (patch) | |
tree | 844c61f13ae49a6eae0fc0d3114539567988f64a /main.py | |
parent | 5b5db451134901077a57c1c5bf73fe3a70ed1fee (diff) |
Fixed locking onto moving cells as food
I totally forgot to account for moving food, derp.
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -90,10 +90,12 @@ while True: color = (255,0,0) print ("Running away: " + str((runaway_x-c.player.center[0], runaway_y-c.player.center[1]))) else: - 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 != None: + target = tuple(target_cell.pos) + 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") |