Ejemplo n.º 1
0
def main(options, args):
    """Start the engine and the game"""
    registerSounds()
    registerMusic()
    registerGraphics()
    #
    if options.musicoff:
        serge.sound.Music.pause()
        serge.sound.Sounds.pause()
    #
    # Create the engine
    engine = startEngine(options)
    #
    # Initialise the main logic
    mainscreen.main(options)
    startscreen.main(options)
    creditsscreen.main(options)
    resumescreen.main(options)
    tutorialscreen.main(options)
    levelscreen.main(options)
    #
    if options.straight:
        engine.setCurrentWorldByName('main-screen')
    if options.tutorial:
        engine.setCurrentWorldByName('tutorial-screen')        
    #   
    if options.debug:
        serge.builder.builder.main(engine, options.framerate)
    else:
        engine.run(options.framerate)
Ejemplo n.º 2
0
def main(options, args, observation):
    """Start the engine and the game"""
    #
    # Set the levels to use - this allows us to switch to AI testing
    # levels rather than the main levels
    if options.test:
        import tests
        theme.setProperty('start-level', 1)
        common.levels = tests
    #
    # Check networkx install
    if not serge.blocks.utils.checkNetworkXVersion(1.8):
        return
    #
    # Create the high scores
    if options.high_score:
        createHighScores(options)
    #
    # Create the engine
    engine = startEngine(options)
    engine.linkEvent(serge.events.E_BEFORE_STOP, stoppingNow)
    engine.addWorld(common.TWEENER)
    #
    registerSounds()
    registerMusic()
    registerGraphics()
    registerEvents()
    #
    # Record a movie
    if options.movie:
        serge.blocks.utils.RecordDesktop(options.movie)
    #
    # Change theme settings
    if options.theme:
        theme.updateFromString(options.theme)
    #
    # Muting
    mute = serge.blocks.actors.MuteButton('mute-button',
                                          'ui',
                                          alpha=G('mute-button-alpha'))
    serge.blocks.utils.addMuteButtonToWorlds(
        mute, center_position=G('mute-button-position'))
    #
    if options.muted:
        mute.toggleSound()
    if options.music_off:
        serge.sound.Music.toggle()
    #
    # Initialise the main logic
    registerAchievements(options)
    mainscreen.main(options, observation)
    startscreen.main(options)
    helpscreen.main(options)
    creditsscreen.main(options)
    levelscreen.main(options)
    actionreplayscreen.main(options)
    randomlevelscreen.main(options)
    #
    if options.debug:
        serge.builder.builder.main(engine, options.framerate)
    else:
        engine.run(options.framerate)