Add a sensible license
[koperkapel.git] / koperkapel / gamelib / enemy_roach.py
index 83523b6d4fdd5caeb0c7dce1dd47ff91bbc00668..c419af53282fca8967d8477376df6dd5ee5cf18a 100644 (file)
@@ -3,9 +3,10 @@
 import random
 
 from pgzero.clock import each_tick, unschedule
+from pgzero.loaders import sounds
 from functools import partial
 
-from ..roaches import t32_roaches, WorldRoach
+from ..roaches import t32_roaches, WorldRoach, default_rats, default_robots
 
 
 def get_enemy_roach(level):
@@ -13,8 +14,49 @@ def get_enemy_roach(level):
     roach.anchor = (-16, -16)  # this should center them on the tile
     roach.game_pos = (0, 0)
     roach.health = 5
+    roach.damage = 1
     roach.angle = 0
+    roach.hit_sound = sounds.load('enemy_hit')
     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 get_rat(level):
+    roach = default_rats.assemble()
+    roach.anchor = (0, 0)
+    roach.game_pos = (0, 0)
+    roach.health = 10
+    roach.damage = 2
+    roach.angle = 0
+    roach.hit_sound = sounds.load('enemy_hit')
+    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 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.hit_sound = sounds.load('enemy_hit')
+    roach.level_layer = 'floor'  # always the case for now
     roach.move = partial(move, roach)
     roach.last_moved = 0
     roach.last_attacked= 0
@@ -45,7 +87,7 @@ def attack(roach, player_pos, player_layer, dt):
         else:
             roach.angle = 270
         # Do 1 damage
-        return 1
+        return roach.damage
 
 def move(roach, dt):
     """Enemy roach move method"""