Example #1
0
        /// <summary>
        /// Switch from one FlxState to another
        /// </summary>
        /// <param name="newscreen">The class name of the state you want (e.g. PlayState)</param>
        public void switchState(FlxState newscreen)
        {
            FlxG.unfollow();
            FlxG.keys.reset();
            FlxG.gamepads.reset();
            FlxG.mouse.reset();

            FlxG.flash.stop();
            FlxG.fade.stop();
            FlxG.quake.stop();

            if (_state != null)
            {
                _state.destroy();
            }
            _state = newscreen;
            _state.create();
        }