Mercurial > rinkhals
comparison gamelib/equipment.py @ 99:f5d56688943b
Added background music support, and daytime and night time music (really animal sounds, not music)
author | David Fraser <davidf@sjsoft.com> |
---|---|
date | Wed, 02 Sep 2009 12:50:28 +0000 |
parents | 5494af02a0e8 |
children | 48019afde338 |
comparison
equal
deleted
inserted
replaced
98:725b292ca07b | 99:f5d56688943b |
---|---|
1 """Stuff for animals to use.""" | 1 """Stuff for animals to use.""" |
2 | 2 |
3 import random | 3 import random |
4 import sound | |
4 | 5 |
5 class Equipment(object): | 6 class Equipment(object): |
6 is_weapon = False | 7 is_weapon = False |
7 | 8 |
8 class Weapon(Equipment): | 9 class Weapon(Equipment): |
22 anything that isn't too far away.""" | 23 anything that isn't too far away.""" |
23 return wielder.pos.dist(target.pos) <= 3 | 24 return wielder.pos.dist(target.pos) <= 3 |
24 | 25 |
25 def hit(self, gameboard, wielder, target): | 26 def hit(self, gameboard, wielder, target): |
26 """Closer is more accurate.""" | 27 """Closer is more accurate.""" |
28 sound.play_sound("fire-rifle.ogg") | |
27 return random.randint(1, 100) > 60 + 10*wielder.pos.dist(target.pos) | 29 return random.randint(1, 100) > 60 + 10*wielder.pos.dist(target.pos) |
28 | 30 |