From: Neil Date: Sat, 5 Mar 2016 21:07:08 +0000 (+0200) Subject: Fix enemy respawning. Slow rate a bit X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=9e66c7b17935e886b9fbed0704727aacda3b0c38;p=koperkapel.git Fix enemy respawning. Slow rate a bit --- diff --git a/koperkapel/gamelib/enemy_generator.py b/koperkapel/gamelib/enemy_generator.py index eaf85d7..b5a1dd4 100644 --- a/koperkapel/gamelib/enemy_generator.py +++ b/koperkapel/gamelib/enemy_generator.py @@ -39,6 +39,8 @@ class EnemyGenerator(Actor): def killed(self, enemy): if enemy in self._made_enemies: self._made_enemies.remove(enemy) + # Delay next respawn so we don't flood the player with enemies + self._time_since_last_update = 0 def pause(self): self.paused = True diff --git a/koperkapel/gamelib/level.py b/koperkapel/gamelib/level.py index aed4ccc..34487af 100644 --- a/koperkapel/gamelib/level.py +++ b/koperkapel/gamelib/level.py @@ -101,6 +101,8 @@ class Level(object): def remove_enemy(self, enemy): self.enemies.remove(enemy) + for generator in self.enemy_generators: + generator.killed(enemy) def add_enemy(self, enemy, x, y): """Add an enemy to an empty floor space near x, y""" diff --git a/koperkapel/levels/level1.json b/koperkapel/levels/level1.json index 88c188a..7ec08b5 100644 --- a/koperkapel/levels/level1.json +++ b/koperkapel/levels/level1.json @@ -4390,7 +4390,7 @@ { "type": "roach", "pos": [18, 8], - "rate": 1.0, + "rate": 2.0, "max": 2 } ] diff --git a/koperkapel/levels/level2.json b/koperkapel/levels/level2.json index 99571fd..4f6dce7 100644 --- a/koperkapel/levels/level2.json +++ b/koperkapel/levels/level2.json @@ -7639,7 +7639,7 @@ { "type": "roach", "pos": [16, 9], - "rate": 1.0, + "rate": 2.0, "max": 2 } ]