Changeset 237
- Timestamp:
- 01/05/07 02:21:51 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 modified
-
setup.py (modified) (1 diff)
-
src/pyspacewar/sounds/README.txt (modified) (1 diff)
-
src/pyspacewar/sounds/electricshock.wav (added)
-
src/pyspacewar/ui.py (modified) (4 diffs)
-
src/pyspacewar/world.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/setup.py
r204 r237 50 50 packages=['pyspacewar'], 51 51 package_dir={'pyspacewar': 'src/pyspacewar'}, 52 package_data={'pyspacewar': ['images/*' ]},52 package_data={'pyspacewar': ['images/*', 'sounds/*']}, 53 53 ) -
trunk/src/pyspacewar/sounds/README.txt
r236 r237 1 1 These are public domain sounds, downloaded from 2 http://www.partnersinrhyme.com/ soundfx/warsounds.shtml2 http://www.partnersinrhyme.com/pir/PIRsfx.shtml -
trunk/src/pyspacewar/ui.py
r236 r237 1972 1972 self.fire_sound = pygame.mixer.Sound(find('sounds', 1973 1973 'Gun_Silencer.wav')) 1974 self.bounce_sound = pygame.mixer.Sound(find('sounds', 1975 'electricshock.wav')) 1974 1976 1975 1977 def _init_fonts(self): … … 1999 2001 rng=self.rng) 2000 2002 self.ships = self.game.ships 2003 for ship in self.ships: 2004 ship.bounce_effect = self.bounce_effect_Ship 2001 2005 self.ai = map(AIController, self.ships) 2002 2006 self.ai_controlled = [False] * len(self.ships) … … 2253 2257 self.fire_sound.play() 2254 2258 2259 def bounce_effect_Ship(self, ship, obstacle): 2260 """Play a sound effect when the player's ship bounces off something.""" 2261 player_id = self.ships.index(ship) 2262 if not self.ai_controlled[player_id]: 2263 self.bounce_sound.play() 2264 2255 2265 def draw(self): 2256 2266 """Draw the state of the game""" … … 2445 2455 self.update_missile_trails() 2446 2456 self.framedrop_needed = not self.game.wait_for_tick() 2447 -
trunk/src/pyspacewar/world.py
r231 r237 346 346 self.appearance = appearance 347 347 self.world = None 348 self.bounce_effect = None 348 349 349 350 def distanceTo(self, other): … … 463 464 collision_distance = other.radius + self.radius 464 465 self.position = other.position + normal.scaled(collision_distance) 466 if self.bounce_effect: 467 self.bounce_effect(self, other) 465 468 466 469 def add_debris(self, howmany=None, maxdistance=1.0, time=5.0):
