Entities are living during two ticks, fixes #80

This commit is contained in:
Yohann D'ANELLO
2021-01-16 00:40:32 +01:00
parent 87e896bd06
commit d978d319bc
3 changed files with 10 additions and 3 deletions

View File

@ -232,14 +232,19 @@ class Explosion(Item):
"""
When a bomb explodes, the explosion is displayed.
"""
def __init__(self, *args, **kwargs):
living_ticks: int
def __init__(self, living_ticks: int = 2, *args, **kwargs):
super().__init__(name="explosion", *args, **kwargs)
self.living_ticks = living_ticks
def act(self, m: Map) -> None:
"""
The bomb disappears after exploding.
"""
m.remove_entity(self)
self.living_ticks -= 1
if self.living_ticks <= 0:
m.remove_entity(self)
def hold(self, player: InventoryHolder) -> None:
"""