Mercurial > skaapsteker
comparison skaapsteker/sprites/player.py @ 273:95e2ef31e714
Hit "down" to interact with things.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Fri, 08 Apr 2011 19:09:09 +0200 |
parents | 630ebb87b38a |
children | 8cac6ff88a9d |
comparison
equal
deleted
inserted
replaced
272:630ebb87b38a | 273:95e2ef31e714 |
---|---|
69 self.rect = cand_rect | 69 self.rect = cand_rect |
70 self.rect_offset = cand_rect_offset | 70 self.rect_offset = cand_rect_offset |
71 self.init_pos() | 71 self.init_pos() |
72 | 72 |
73 def update(self): | 73 def update(self): |
74 self._touching_actionables = [] | |
74 v_x, v_y = self.velocity | 75 v_x, v_y = self.velocity |
75 # Never animate slower than !7 fps, never faster than ~15 fps | 76 # Never animate slower than !7 fps, never faster than ~15 fps |
76 if self.attacking > 0: | 77 if self.attacking > 0: |
77 if self._last_time: | 78 if self._last_time: |
78 if time.time() - self._last_time > 0.15: | 79 if time.time() - self._last_time > 0.15: |
223 if self.on_solid: | 224 if self.on_solid: |
224 self.deltav((0.0, -self.terminal_velocity[1])) | 225 self.deltav((0.0, -self.terminal_velocity[1])) |
225 self.on_solid = False | 226 self.on_solid = False |
226 | 227 |
227 def action_down(self): | 228 def action_down(self): |
228 self.deltav((0.0, 100.0)) | 229 print self._touching_actionables |
230 for actionable in self._touching_actionables[:1]: | |
231 actionable.player_action(self) | |
232 | |
229 | 233 |
230 def action_fire1(self): | 234 def action_fire1(self): |
231 # FIXME: Use the correct tail properties for this | 235 # FIXME: Use the correct tail properties for this |
232 if len(self.the_world.fox.tails) < 2: | 236 if len(self.the_world.fox.tails) < 2: |
233 # Only have a bite attack | 237 # Only have a bite attack |
294 return | 298 return |
295 getattr(self.the_world.items, item.name).level = "gone" | 299 getattr(self.the_world.items, item.name).level = "gone" |
296 self.the_world.fox.item = item.name | 300 self.the_world.fox.item = item.name |
297 item.kill() | 301 item.kill() |
298 print "took", item | 302 print "took", item |
303 | |
304 | |
305 def add_actionable(self, actionable): | |
306 self._touching_actionables.append(actionable) |