comparison skaapsteker/sprites/player.py @ 336:c8fd82ff0c71

Hook up fire buttons to attack functions. Use correct check for tails. Add skeleton for projectiles.
author Simon Cross <hodgestar@gmail.com>
date Sat, 09 Apr 2011 12:29:34 +0200
parents c6552e9fc2e1
children a9d760134706
comparison
equal deleted inserted replaced
335:c6552e9fc2e1 336:c8fd82ff0c71
232 if self._touching_actionables: 232 if self._touching_actionables:
233 self._touching_actionables[0].player_action(self) 233 self._touching_actionables[0].player_action(self)
234 elif self._me.item is not None: 234 elif self._me.item is not None:
235 self.drop_item() 235 self.drop_item()
236 236
237 def _bite_attack(self):
238 print 'ninja bite attack'
239 self.attacking = 2
240 self._last_time = time.time() # Reset the animation clock
241
242 def _fireball_attack(self):
243 print 'ninja fireball attack attack attack'
244 self.attacking = 2
245 self._last_time = time.time() # Reset the animation clock
246
247 def _lightning_attack(self):
248 print 'thunderbolts and lightning'
249 self.attacking = 2
250 self._last_time = time.time() # Reset the animation clock
237 251
238 def action_fire1(self): 252 def action_fire1(self):
239 # FIXME: Use the correct tail properties for this 253 if "fireball" not in self._me.tails:
240 if len(self._me.tails) < 2: 254 self._bite_attack()
241 # Only have a bite attack 255 else:
242 print 'attacking' 256 self._fireball_attack()
243 self.attacking = 2
244 # Reset the animation clock
245 self._last_time = time.time()
246 print "F1"
247 257
248 def action_fire2(self): 258 def action_fire2(self):
249 print "F2" 259 if "lightning" not in self._me.tails:
260 self._bite_attack()
261 else:
262 self._lightning_attack()
250 263
251 def _get_action(self): 264 def _get_action(self):
252 if self.attacking: 265 if self.attacking:
253 return 'attacking' 266 return 'attacking'
254 if (self.sprinting > 0) and self.running: 267 if (self.sprinting > 0) and self.running:
359 372
360 373
361 def add_actionable(self, actionable): 374 def add_actionable(self, actionable):
362 self._touching_actionables.append(actionable) 375 self._touching_actionables.append(actionable)
363 376
364
365 def eat_aburage(self): 377 def eat_aburage(self):
366 self._me.tofu += 1 378 self._me.tofu += 1
367