Ignore:
Timestamp:
09/07/13 12:36:09 (8 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Phase:
public
Message:

Add Death event to reduce death code duplication

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/protagonist.py

    r437 r440  
    1212from nagslang.game_object import (
    1313    GameObject, Physicser, Result, Bullet, ClawAttack, make_body)
    14 from nagslang.level import Level
    1514from nagslang.mutators import FLIP_H
    1615from nagslang.resources import resources
    17 from nagslang.events import ScreenChange
     16from nagslang.events import DeathEvent
    1817from nagslang.utils import vec_from_angle, vec_with_length
    1918
     
    340339        # Handle player death - may be called due to other reasons
    341340        # than zero health
    342         self.world.load()
    343         self.world.deaths += 1
    344         level, pos = Level.game_starting_point()
    345         self.set_position(pos)
    346         ScreenChange.post(level)
     341        self.reset()
     342        DeathEvent.post()
    347343
    348344    def lose_health(self, amount):
Note: See TracChangeset for help on using the changeset viewer.