Changeset 411:03d5cb669298
- Timestamp:
- Nov 21, 2009, 11:18:08 AM (11 years ago)
- Branch:
- default
- Convert:
- svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68/trunk/rinkhals@416
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
gamelib/engine.py
r396 r411 149 149 elif e.type is KEYDOWN and e.key == K_ESCAPE: 150 150 self.dialog = check_exit() 151 elif e.type is ANIM_ID:152 self.game.gameboard.run_animations()153 151 elif e.type is KEYDOWN and e.key == K_n: 154 152 return pygame.event.post(START_NIGHT) … … 213 211 elif e.type is KEYDOWN and e.key == K_ESCAPE: 214 212 self.dialog = check_exit() 215 elif e.type is ANIM_ID:216 self.game.gameboard.run_animations()217 213 elif e.type is MOVE_FOX_ID: 218 214 # ensure no timers trigger while we're running -
gamelib/main.py
r389 r411 7 7 ''' 8 8 9 import sys 10 9 11 import pygame 10 12 from pgu import gui … … 14 16 from sound import init_sound 15 17 import constants 18 from config import config 16 19 import data 17 import sys18 20 19 21 def create_main_app(screen): … … 27 29 def main(): 28 30 """Main script.""" 31 config.configure(sys.argv[1:]) 29 32 init_sound() 30 33 screen = pygame.display.set_mode(constants.SCREEN, SWSURFACE) … … 35 38 from engine import Engine, MainMenuState 36 39 37 if len(sys.argv) > 1: 38 level_name = sys.argv[1] 39 else: 40 level_name = 'two_weeks' 41 42 engine = Engine(main_app, level_name) 40 engine = Engine(main_app, config.level_name) 43 41 try: 44 42 engine.run(MainMenuState(engine), screen) -
gamelib/sound.py
r363 r411 1 1 import os 2 import pygame3 2 import sys 4 3 4 import pygame 5 5 6 import data 7 from config import config 6 8 import constants 7 9 … … 11 13 """initialize the sound system""" 12 14 global SOUND_INITIALIZED 15 if not config.sound: 16 return 13 17 try: 14 18 pygame.mixer.init(constants.FREQ, constants.BITSIZE, constants.CHANNELS, constants.BUFFER) … … 21 25 def play_sound(filename): 22 26 """plays the sound with the given filename from the data sounds directory""" 23 if not SOUND_INITIALIZED:27 if not (SOUND_INITIALIZED and config.sound): 24 28 return 25 29 file_path = data.filepath("sounds", filename) … … 36 40 """stops any playing background music""" 37 41 global CURRENT_MUSIC_FILE 38 if not SOUND_INITIALIZED:42 if not (SOUND_INITIALIZED and config.sound): 39 43 return 40 44 CURRENT_MUSIC_FILE = None … … 45 49 """plays the background music with the given filename from the data sounds directory""" 46 50 global CURRENT_MUSIC_FILE 47 if not SOUND_INITIALIZED:51 if not (SOUND_INITIALIZED and config.sound): 48 52 return 49 53 file_path = data.filepath("sounds", filename)
Note: See TracChangeset
for help on using the changeset viewer.