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

Use Result to handle firing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/protagonist.py

    r375 r393  
    1010    NON_GAME_OBJECT_COLLIDERS, BULLET_DAMAGE, BULLET_SPEED, CLAW_DAMAGE,
    1111    CMD_TOGGLE_FORM, CMD_ACTION)
    12 from nagslang.events import FireEvent, ClawEvent
    13 from nagslang.game_object import GameObject, Physicser, make_body
     12from nagslang.events import ClawEvent
     13from nagslang.game_object import (
     14    GameObject, Physicser, Result, Bullet, make_body)
    1415from nagslang.mutators import FLIP_H
    1516from nagslang.resources import resources
     
    193194        self.start_timer('attack_cooldown')
    194195        self.world.attacks += 1
    195         self.attack()
     196        return self.attack()
    196197
    197198    def handle_keypress(self, key_command):
     
    295296        """
    296297        if self.in_wolf_form():
    297             self.claw()
     298            return self.claw()
    298299        else:
    299             self.shoot()
     300            return self.shoot()
    300301
    301302    def shoot(self):
     
    303304            return
    304305        vec = vec_from_angle(self.angle, BULLET_SPEED)
    305         FireEvent.post(
    306             self.physicser.position, vec, BULLET_DAMAGE, 'bullet',
    307             COLLISION_TYPE_PLAYER)
     306        return Result(add=(Bullet(self.get_space(), self.physicser.position,
     307                                  vec, BULLET_DAMAGE, 'bullet',
     308                                  COLLISION_TYPE_PLAYER),))
    308309
    309310    def claw(self):
Note: See TracChangeset for help on using the changeset viewer.