Mercurial > rinkhals
comparison gamelib/animal.py @ 429:42777630956a
Add ammo to things serialized and deserialized.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 16:28:27 +0000 |
parents | a356e57529ea |
children | 129de5883524 |
comparison
equal
deleted
inserted
replaced
428:a356e57529ea | 429:42777630956a |
---|---|
273 if weapon.hit(gameboard, self, fox): | 273 if weapon.hit(gameboard, self, fox): |
274 fox.damage(gameboard) | 274 fox.damage(gameboard) |
275 | 275 |
276 def reload_weapon(self): | 276 def reload_weapon(self): |
277 """If we have a weapon that takes ammunition, reload it.""" | 277 """If we have a weapon that takes ammunition, reload it.""" |
278 if not self.weapons(): | |
279 # Nothing to reload | |
280 return | |
281 for weapon in self.weapons(): | 278 for weapon in self.weapons(): |
282 if hasattr(weapon, 'AMMUNITION'): | 279 weapon.refresh_ammo() |
283 weapon.ammunition = weapon.AMMUNITION | |
284 | 280 |
285 class Egg(Animal): | 281 class Egg(Animal): |
286 """An egg""" | 282 """An egg""" |
287 | 283 |
288 IMAGE_FILE = 'sprites/equip_egg.png' | 284 IMAGE_FILE = 'sprites/equip_egg.png' |