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

(really rubbish) bullets

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r258 r261  
    77from nagslang.constants import COLLISION_TYPE_PLAYER, CALLBACK_COLLIDERS, \
    88    COLLISION_TYPE_ENEMY
    9 from nagslang.events import ScreenChange, DoorEvent
     9from nagslang.events import ScreenChange, DoorEvent, FireEvent
    1010from nagslang.level import Level
    1111from nagslang.protagonist import Protagonist
    1212from nagslang.screens.base import Screen
     13from nagslang.game_object import Bullet
    1314
    1415
     
    131132                self.protagonist.toggle_form()
    132133                self.world.transformations += 1
     134            if ev.key == pygame.locals.K_SPACE:
     135                self.world.attacks += 1
     136                self.protagonist.attack()
    133137        elif DoorEvent.matches(ev):
    134138            self.protagonist.set_position(ev.dest_pos)
     
    141145            # else we're teleporting within the screen, and just the
    142146            # position change is enough
     147        elif FireEvent.matches(ev):
     148            bullet = Bullet(self.space, ev.source, ev.impulse)
     149            self._drawables.add(bullet)
    143150        self.keys.handle_event(ev)
    144151
Note: See TracChangeset for help on using the changeset viewer.