diff options
author | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-03-18 12:34:18 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <vn.mcsinyx@gmail.com> | 2019-03-18 12:34:18 +0700 |
commit | e2562e1698cc1aa053277660a7e67f5fcb60c77f (patch) | |
tree | 23bea32a6efb63492c4dadc0d7681f269a916142 | |
parent | 7a0ace220c7acfa8df5a4fe494f424b5d9970a06 (diff) | |
download | brutalmaze-e2562e1698cc1aa053277660a7e67f5fcb60c77f.tar.gz |
Prevent player from creating enemy when there isn't any
-rw-r--r-- | brutalmaze/game.py | 2 | ||||
-rw-r--r-- | brutalmaze/maze.py | 7 | ||||
-rwxr-xr-x | setup.py | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/brutalmaze/game.py b/brutalmaze/game.py index 65fcffb..cd34199 100644 --- a/brutalmaze/game.py +++ b/brutalmaze/game.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Brutal Maze. If not, see <https://www.gnu.org/licenses/>. -__version__ = '0.8.24' +__version__ = '0.8.25' import re from argparse import ArgumentParser, FileType, RawTextHelpFormatter diff --git a/brutalmaze/maze.py b/brutalmaze/maze.py index 9830611..ef4f13f 100644 --- a/brutalmaze/maze.py +++ b/brutalmaze/maze.py @@ -311,7 +311,10 @@ class Maze: if wound <= 0 or not self.isdisplayed(gridx, gridy): fallen.append(i) elif bullet.color == 'Aluminium': + active_enemies = [e for e in self.enemies if e.awake] if self.map[gridx][gridy] == WALL and self.next_move <= 0: + fallen.append(i) + if not active_enemies: continue self.glitch = wound * 1000 enemy = new_enemy(self, gridx, gridy) enemy.awake = True @@ -319,10 +322,8 @@ class Maze: play(self.sfx_spawn, enemy.spawn_volumn, enemy.get_angle()) enemy.hit(wound) self.enemies.append(enemy) - fallen.append(i) continue - for j, enemy in enumerate(self.enemies): - if not enemy.awake: continue + for j, enemy in enumerate(active_enemies): if bullet.get_distance(*enemy.pos) < self.distance: enemy.hit(wound) if enemy.wound >= ENEMY_HP: diff --git a/setup.py b/setup.py index ad9814a..15bf0da 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ with open('README.rst') as f: setup( name='brutalmaze', - version='0.8.24', + version='0.8.25', description="Minimalist thrilling shoot 'em up game", long_description=long_description, url='https://github.com/McSinyx/brutalmaze', |