Mercurial > skaapsteker
comparison skaapsteker/sprites/player.py @ 102:2e913a89e69d
Link up key presses to calls to action functions on player and to quitting level.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Mon, 04 Apr 2011 20:23:14 +0200 |
parents | 3eafceff6293 |
children | aaef228b6358 |
comparison
equal
deleted
inserted
replaced
101:b502e732f821 | 102:2e913a89e69d |
---|---|
40 | 40 |
41 def set_pos(self, pos): | 41 def set_pos(self, pos): |
42 self.starting_tile_pos = pos | 42 self.starting_tile_pos = pos |
43 self.rect = self.image.get_rect(topleft=(pos[0]*TILE_SIZE[0], pos[1]*TILE_SIZE[1])) | 43 self.rect = self.image.get_rect(topleft=(pos[0]*TILE_SIZE[0], pos[1]*TILE_SIZE[1])) |
44 | 44 |
45 def action_left(self): | |
46 print "L" | |
45 | 47 |
46 def dispatch(self, ev): | 48 def action_right(self): |
47 pass | 49 print "R" |
50 | |
51 def action_up(self): | |
52 print "U" | |
53 | |
54 def action_down(self): | |
55 print "D" | |
56 | |
57 def action_fire1(self): | |
58 print "F1" | |
59 | |
60 def action_fire2(self): | |
61 print "F2" | |
48 | 62 |
49 def _get_action(self): | 63 def _get_action(self): |
50 if self.running: | 64 if self.running: |
51 return 'running' | 65 return 'running' |
52 if self.jumping: | 66 if self.jumping: |
53 return 'jumpin' | 67 return 'jumpin' |
54 return 'standing' | 68 return 'standing' |
55 | |
56 | 69 |
57 def _make_key(self, action=None): | 70 def _make_key(self, action=None): |
58 if action is None: | 71 if action is None: |
59 action = self._get_action() | 72 action = self._get_action() |
60 tails = self.tails | 73 tails = self.tails |