import random
-from pgzero.clock import each_tick
+from pgzero.clock import each_tick, unschedule
from functools import partial
from ..roaches import t32_roaches, WorldRoach
def get_enemy_roach(level):
roach = t32_roaches.assemble(WorldRoach(), color=(255, 0, 0, 255))
- roach.anchor = (0, 0)
+ roach.anchor = (-16, -16) # this should center them on the tile
roach.game_pos = (0, 0)
roach.health = 5
roach.level = level
def move(roach, dt):
"""Enemy roach move method"""
roach.last_moved += dt
+ if not roach in roach.level.enemies:
+ unschedule(roach.move)
+ return
if roach.last_moved > 0.5:
if not roach.start_pos:
roach.start_pos = roach.game_pos