//This function is passed to FlxG.fade() when we are ready to go to the next game state. //When FlxG.fade() finishes, it will call this, which in turn will either load //up a game demo/replay, or let the player start playing, depending on user input. protected void onFade() { /*if(attractMode) FlxG.loadReplay((FlxG.random()<0.5f)?FlxG.loadString(Attract1):FlxG.loadString(Attract2),new ModePlayState(),new String[]{"ANY"},22, onDemoComplete); else*/ FlxG.switchState(new ModePlayState()); }
public override void update() { base.update(); if (FlxG.keys.justPressed(Keys.Up)) { if (selectedID == 0) { selectedID = (int)_items.length - 1; } else { selectedID--; } updateSelected(); } if (FlxG.keys.justPressed(Keys.Down)) { if (selectedID == (int)_items.length - 1) { selectedID = 0; } else { selectedID++; } updateSelected(); } if (FlxG.keys.justPressed(Keys.Enter)) { FlxG.switchState(_states[selectedID]); } }
//This just quits - state.destroy() is automatically called upon state changing private void onQuit() { FlxG.switchState(new MenuState()); }
//A FlxG.fade callback, like in MenuState. protected void onVictory() { FlxG.music.stop(); FlxG.switchState(new VictoryState()); }
// function called when the quit button is pressed private void onQuit() { // Go back to the MenuState FlxG.switchState(new MenuState()); }
public void onPlay() { FlxG.switchState(new ModePlayState()); }