| | 1995 | config = ConfigParser.RawConfigParser() |
| | 1996 | config.add_section('sounds') |
| | 1997 | config.read([find('sounds', 'sounds.ini')]) |
| | 1998 | |
| | 1999 | def load_sound(name): |
| | 2000 | if config.has_option('sounds', name): |
| | 2001 | filename = config.get('sounds', name) |
| | 2002 | if filename: |
| | 2003 | try: |
| | 2004 | return pygame.mixer.Sound(find('sounds', filename)) |
| | 2005 | except pygame.error: |
| | 2006 | print "pyspacewar: could not load %s" % filename |
| | 2007 | return NoSound() |
| | 2008 | |
| 1986 | | self.fire_sound = pygame.mixer.Sound(find('sounds', |
| 1987 | | 'Gun_Silencer.wav')) |
| 1988 | | self.bounce_sound = pygame.mixer.Sound(find('sounds', |
| 1989 | | 'electricshock.wav')) |
| 1990 | | self.hit_sound = pygame.mixer.Sound(find('sounds', 'Grenade2.wav')) |
| 1991 | | self.explode_sound = pygame.mixer.Sound(find('sounds', 'bomb.wav')) |
| 1992 | | self.respawn_sound = pygame.mixer.Sound(find('sounds', 'coin2.wav')) |
| 1993 | | self.menu_sound = pygame.mixer.Sound(find('sounds', 'briefcs1.wav')) |
| | 2012 | self.fire_sound = load_sound('fire') |
| | 2013 | self.bounce_sound = load_sound('bounce') |
| | 2014 | self.hit_sound = load_sound('hit') |
| | 2015 | self.explode_sound = load_sound('explode') |
| | 2016 | self.respawn_sound = load_sound('respawn') |
| | 2017 | self.menu_sound = load_sound('menu') |