Add a small bomb exploding animation, fixes #31
This commit is contained in:
@ -158,6 +158,10 @@ class Bomb(Item):
|
||||
m.logs.add_message(log_message)
|
||||
m.entities.remove(self)
|
||||
|
||||
# Add sparkles where the bomb exploded.
|
||||
explosion = Explosion(y=self.y, x=self.x)
|
||||
self.map.add_entity(explosion)
|
||||
|
||||
def save_state(self) -> dict:
|
||||
"""
|
||||
Saves the state of the bomb into a dictionary
|
||||
@ -168,6 +172,26 @@ class Bomb(Item):
|
||||
return d
|
||||
|
||||
|
||||
class Explosion(Item):
|
||||
"""
|
||||
When a bomb explodes, the explosion is displayed.
|
||||
"""
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(name="explosion", *args, **kwargs)
|
||||
|
||||
def act(self, m: Map) -> None:
|
||||
"""
|
||||
The explosion instant dies.
|
||||
"""
|
||||
m.remove_entity(self)
|
||||
|
||||
def hold(self, player: InventoryHolder) -> None:
|
||||
"""
|
||||
The player can't hold any explosion.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class Weapon(Item):
|
||||
"""
|
||||
Non-throwable items that improve player damage
|
||||
|
Reference in New Issue
Block a user