level fix and robots
[koperkapel.git] / koperkapel / gamelib / enemy_roach.py
index 2dd2f2bc8276cde542e7bdf7f373fef8e254983f..95805be49f2f0f0f857ef23a748d83fbdfd0322d 100644 (file)
@@ -5,7 +5,7 @@ import random
 from pgzero.clock import each_tick, unschedule
 from functools import partial
 
-from ..roaches import t32_roaches, WorldRoach, default_rats
+from ..roaches import t32_roaches, WorldRoach, default_rats, default_robots
 
 
 def get_enemy_roach(level):
@@ -34,6 +34,7 @@ def get_rat(level):
     roach.damage = 2
     roach.angle = 0
     roach.level = level
+    roach.level_layer = 'floor'  # always the case for now
     roach.move = partial(move, roach)
     roach.last_moved = 0
     roach.last_attacked= 0
@@ -42,6 +43,25 @@ def get_rat(level):
     roach.attack = partial(attack, roach)
     return roach
 
+
+def get_robot(level):
+    roach = default_robots.assemble()
+    roach.anchor = (0, 0)
+    roach.game_pos = (0, 0)
+    roach.health = 10
+    roach.damage = 5
+    roach.angle = 0
+    roach.level = level
+    roach.level_layer = 'floor'  # always the case for now
+    roach.move = partial(move, roach)
+    roach.last_moved = 0
+    roach.last_attacked= 0
+    roach.start_pos = None
+    each_tick(roach.move)
+    roach.attack = partial(attack, roach)
+    return roach
+
+
 def attack(roach, player_pos, player_layer, dt):
     """Attack the player if close enough"""
     roach.last_attacked += dt