Prevent player from creating enemy when there isn't any

This commit is contained in:
Nguyễn Gia Phong 2019-03-18 12:34:18 +07:00
parent 7a0ace220c
commit e2562e1698
3 changed files with 6 additions and 5 deletions

View File

@ -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

View File

@ -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:

View File

@ -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',