Changeset 239
- Timestamp:
- 01/05/07 02:43:51 (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 modified
-
NEWS.txt (modified) (1 diff)
-
src/pyspacewar/sounds/Grenade2.au (added)
-
src/pyspacewar/sounds/Grenade2.wav (added)
-
src/pyspacewar/sounds/README.txt (modified) (1 diff)
-
src/pyspacewar/sounds/bomb.wav (added)
-
src/pyspacewar/ui.py (modified) (3 diffs)
-
src/pyspacewar/world.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS.txt
r236 r239 8 8 a better video mode; if not, give a better first impression by avoiding 9 9 sluggishness. 10 - Sound effects! Well, one sound effect.10 - Sound effects! 11 11 12 12 December 25, 2006: Released version 0.9.3: the Christmas release. -
trunk/src/pyspacewar/sounds/README.txt
r237 r239 1 1 These are public domain sounds, downloaded from 2 2 http://www.partnersinrhyme.com/pir/PIRsfx.shtml 3 4 Grenade2.wav was produced from Grenade2.pcm with 5 mplayer Grenade2.au -ao pcm:file=Grenade2.wav -
trunk/src/pyspacewar/ui.py
r238 r239 1974 1974 self.bounce_sound = pygame.mixer.Sound(find('sounds', 1975 1975 'electricshock.wav')) 1976 self.hit_sound = pygame.mixer.Sound(find('sounds', 'Grenade2.wav')) 1977 self.explode_sound = pygame.mixer.Sound(find('sounds', 'bomb.wav')) 1976 1978 1977 1979 def _init_fonts(self): … … 2003 2005 for ship in self.ships: 2004 2006 ship.bounce_effect = self.bounce_effect_Ship 2007 ship.hit_effect = self.hit_effect_Ship 2008 ship.explode_effect = self.explode_effect_Ship 2005 2009 self.ai = map(AIController, self.ships) 2006 2010 self.ai_controlled = [False] * len(self.ships) … … 2260 2264 """Play a sound effect when the player's ship bounces off something.""" 2261 2265 player_id = self.ships.index(ship) 2266 if not self.ai_controlled[player_id] and not ship.dead: 2267 self.bounce_sound.play() 2268 2269 def hit_effect_Ship(self, ship, missile): 2270 """Play a sound effect when the player's ship is hit.""" 2271 player_id = self.ships.index(ship) 2262 2272 if not self.ai_controlled[player_id]: 2263 self.bounce_sound.play() 2273 self.hit_sound.play() 2274 2275 def explode_effect_Ship(self, ship, killer): 2276 """Play a sound effect when the player's ship explodes.""" 2277 player_id = self.ships.index(ship) 2278 if not self.ai_controlled[player_id]: 2279 self.explode_sound.play() 2264 2280 2265 2281 def draw(self): -
trunk/src/pyspacewar/world.py
r237 r239 556 556 self.dead = False 557 557 self.spawn_time = 0 # the value of world.time when last respawned 558 self.hit_effect = None 559 self.explode_effect = None 558 560 559 561 def _set_direction(self, direction): … … 640 642 killed_by = other.launched_by 641 643 self.velocity += other.velocity * self.missile_recoil 644 if self.hit_effect: 645 self.hit_effect(self, other) 642 646 else: 643 647 self.health -= self.collision_damage … … 659 663 self.add_debris(time=50, maxdistance=self.size * 0.5, 660 664 howmany=self.world.rng.randrange(9, 21)) 665 if self.explode_effect: 666 self.explode_effect(self, killed_by) 661 667 662 668 def respawn(self):
