def _make_enemy(self):
if self.enemy_type == 'roach':
- roach = get_enemy_roach()
+ roach = get_enemy_roach(self.level)
self._made_enemies.append(roach)
self.level.add_enemy(roach, *self.gen_pos)
# Roach utilities
+import random
+
+from pgzero.clock import each_tick
+from functools import partial
+
from ..roaches import t32_roaches, WorldRoach
-def get_enemy_roach():
- # red
+def get_enemy_roach(level):
roach = t32_roaches.assemble(WorldRoach(), color=(255, 0, 0, 255))
roach.anchor = (0, 0)
roach.game_pos = (0, 0)
roach.health = 5
+ roach.level = level
+ roach.move = partial(move, roach)
+ roach.last_moved = 0
+ each_tick(roach.move)
return roach
+
+
+def move(roach, dt):
+ """Enemy roach move method"""
+ roach.last_moved += dt
+ if roach.last_moved > 0.5:
+ print('Moving')
+ roach.last_moved = 0