Changeset 394:76f053cf2322


Ignore:
Timestamp:
Sep 6, 2013, 11:10:53 PM (7 years ago)
Author:
Stefano Rivera <stefano@…>
Branch:
default
Message:

Use Result instead of ClawEvent?

Location:
nagslang
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nagslang/events.py

    r393 r394  
    5151    def post(cls):
    5252        super(EnemyDeathEvent, cls).post()
    53 
    54 
    55 class ClawEvent(UserEvent):
    56     @classmethod
    57     def post(cls, source, vector, damage):
    58         super(ClawEvent, cls).post(source=source, vector=vector, damage=damage)
  • nagslang/protagonist.py

    r393 r394  
    1010    NON_GAME_OBJECT_COLLIDERS, BULLET_DAMAGE, BULLET_SPEED, CLAW_DAMAGE,
    1111    CMD_TOGGLE_FORM, CMD_ACTION)
    12 from nagslang.events import ClawEvent
    1312from nagslang.game_object import (
    14     GameObject, Physicser, Result, Bullet, make_body)
     13    GameObject, Physicser, Result, Bullet, ClawAttack, make_body)
    1514from nagslang.mutators import FLIP_H
    1615from nagslang.resources import resources
     
    313312                      / 20) + 30
    314313        vec = vec_from_angle(self.angle, claw_range)
    315         ClawEvent.post(self.physicser.position, vec, CLAW_DAMAGE)
     314        return Result(add=(ClawAttack(
     315            self.get_space(), self.physicser.position, vec, CLAW_DAMAGE),))
    316316
    317317    def in_wolf_form(self):
  • nagslang/screens/area.py

    r393 r394  
    99    COLLISION_TYPE_FURNITURE, COLLISION_TYPE_WEREWOLF_ATTACK,
    1010    CMD_TOGGLE_FORM, CMD_ACTION)
    11 from nagslang.events import ScreenChange, DoorEvent, EnemyDeathEvent, ClawEvent
     11from nagslang.events import ScreenChange, DoorEvent, EnemyDeathEvent
    1212from nagslang.level import Level
    1313from nagslang.screens.base import Screen
    14 from nagslang.game_object import ClawAttack
    1514from nagslang.sound import sound
    1615
     
    180179        elif EnemyDeathEvent.matches(ev):
    181180            self.world.kills += 1
    182         elif ClawEvent.matches(ev):
    183             claw_attack = ClawAttack(self.space, ev.source, ev.vector,
    184                                      ev.damage)
    185             self._drawables.add(claw_attack)
    186181        self.keys.handle_event(ev)
    187182
Note: See TracChangeset for help on using the changeset viewer.