Ignore:
Timestamp:
09/06/13 19:56:57 (8 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Automatic weapons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r365 r371  
    88    COLLISION_TYPE_WALL, COLLISION_TYPE_PLAYER, CALLBACK_COLLIDERS,
    99    COLLISION_TYPE_FURNITURE, COLLISION_TYPE_WEREWOLF_ATTACK,
    10     CMD_TOGGLE_FORM, CMD_ATTACK, CMD_ACTION)
     10    CMD_TOGGLE_FORM, CMD_ACTION)
    1111from nagslang.enemies import DeadEnemy
    1212from nagslang.events import (
     
    2626    }
    2727
     28    attack_keys = set([pygame.locals.K_z, pygame.locals.K_LCTRL])
     29
    2830    command_keys = {
    2931        pygame.locals.K_c: CMD_TOGGLE_FORM,
    30         pygame.locals.K_z: CMD_ATTACK,
    31         pygame.locals.K_LCTRL: CMD_ATTACK,
    3232        pygame.locals.K_SPACE: CMD_ACTION,
    3333    }
     
    5555                dy += ty
    5656        return (dx, dy)
     57
     58    def is_attacking(self):
     59        return bool(self.keys_down & self.attack_keys)
    5760
    5861    def get_command_key(self, key):
     
    234237        dx, dy = self.keys.get_direction()
    235238        self.protagonist.set_direction(dx, dy)
     239        if self.keys.is_attacking():
     240            self.protagonist.handle_attack_key_down()
    236241
    237242    def tick(self, seconds):
Note: See TracChangeset for help on using the changeset viewer.