Enemigo rojo cambia color tras disparo
This commit is contained in:
parent
0830bc5d46
commit
b25d67788e
@ -414,13 +414,21 @@ class Game:
|
|||||||
self.entities.append(Enemy(5.0, y, destructible=False))
|
self.entities.append(Enemy(5.0, y, destructible=False))
|
||||||
|
|
||||||
def handle_collisions(self):
|
def handle_collisions(self):
|
||||||
# Muerte por contacto con enemigo
|
# Muerte por contacto de un enemigo con el Jugador O con el VORTEX
|
||||||
for entity in self.entities:
|
for entity in self.entities:
|
||||||
if isinstance(entity, Enemy):
|
if isinstance(entity, Enemy):
|
||||||
if (
|
# Colisión con el Jugador
|
||||||
|
touch_player = (
|
||||||
abs(entity.gx - self.player.gx) < 0.5
|
abs(entity.gx - self.player.gx) < 0.5
|
||||||
and abs(entity.gy - self.player.gy) < 0.5
|
and abs(entity.gy - self.player.gy) < 0.5
|
||||||
):
|
)
|
||||||
|
# Colisión con el VORTEX
|
||||||
|
touch_vortex = (
|
||||||
|
abs(entity.gx - self.vortex.gx) < 0.6
|
||||||
|
and abs(entity.gy - self.vortex.gy) < 0.6
|
||||||
|
)
|
||||||
|
|
||||||
|
if touch_player or touch_vortex:
|
||||||
self.lives -= 1
|
self.lives -= 1
|
||||||
if self.lives > 0:
|
if self.lives > 0:
|
||||||
self.reset_level()
|
self.reset_level()
|
||||||
|
|||||||
BIN
img-versiones/version_2.2.png
Normal file
BIN
img-versiones/version_2.2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Loading…
x
Reference in New Issue
Block a user