Prevent player from creating enemy when there isn't any
This commit is contained in:
parent
7a0ace220c
commit
e2562e1698
|
@ -17,7 +17,7 @@
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
# 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/>.
|
# along with Brutal Maze. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__version__ = '0.8.24'
|
__version__ = '0.8.25'
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from argparse import ArgumentParser, FileType, RawTextHelpFormatter
|
from argparse import ArgumentParser, FileType, RawTextHelpFormatter
|
||||||
|
|
|
@ -311,7 +311,10 @@ class Maze:
|
||||||
if wound <= 0 or not self.isdisplayed(gridx, gridy):
|
if wound <= 0 or not self.isdisplayed(gridx, gridy):
|
||||||
fallen.append(i)
|
fallen.append(i)
|
||||||
elif bullet.color == 'Aluminium':
|
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:
|
if self.map[gridx][gridy] == WALL and self.next_move <= 0:
|
||||||
|
fallen.append(i)
|
||||||
|
if not active_enemies: continue
|
||||||
self.glitch = wound * 1000
|
self.glitch = wound * 1000
|
||||||
enemy = new_enemy(self, gridx, gridy)
|
enemy = new_enemy(self, gridx, gridy)
|
||||||
enemy.awake = True
|
enemy.awake = True
|
||||||
|
@ -319,10 +322,8 @@ class Maze:
|
||||||
play(self.sfx_spawn, enemy.spawn_volumn, enemy.get_angle())
|
play(self.sfx_spawn, enemy.spawn_volumn, enemy.get_angle())
|
||||||
enemy.hit(wound)
|
enemy.hit(wound)
|
||||||
self.enemies.append(enemy)
|
self.enemies.append(enemy)
|
||||||
fallen.append(i)
|
|
||||||
continue
|
continue
|
||||||
for j, enemy in enumerate(self.enemies):
|
for j, enemy in enumerate(active_enemies):
|
||||||
if not enemy.awake: continue
|
|
||||||
if bullet.get_distance(*enemy.pos) < self.distance:
|
if bullet.get_distance(*enemy.pos) < self.distance:
|
||||||
enemy.hit(wound)
|
enemy.hit(wound)
|
||||||
if enemy.wound >= ENEMY_HP:
|
if enemy.wound >= ENEMY_HP:
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ with open('README.rst') as f:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='brutalmaze',
|
name='brutalmaze',
|
||||||
version='0.8.24',
|
version='0.8.25',
|
||||||
description="Minimalist thrilling shoot 'em up game",
|
description="Minimalist thrilling shoot 'em up game",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
url='https://github.com/McSinyx/brutalmaze',
|
url='https://github.com/McSinyx/brutalmaze',
|
||||||
|
|
Loading…
Reference in New Issue