gamepad support and keybind cleaning up
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package;
|
||||
|
||||
import flixel.input.gamepad.FlxGamepad;
|
||||
import flash.text.TextField;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxSprite;
|
||||
@ -184,10 +185,32 @@ class FreeplayState extends MusicBeatState
|
||||
scoreText.text = "PERSONAL BEST:" + lerpScore;
|
||||
comboText.text = combo + '\n';
|
||||
|
||||
var upP = controls.UP_P;
|
||||
var downP = controls.DOWN_P;
|
||||
var upP = FlxG.keys.justPressed.UP;
|
||||
var downP = FlxG.keys.justPressed.DOWN;
|
||||
var accepted = controls.ACCEPT;
|
||||
|
||||
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
|
||||
|
||||
if (gamepad != null)
|
||||
{
|
||||
if (gamepad.justPressed.DPAD_UP)
|
||||
{
|
||||
changeSelection(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_DOWN)
|
||||
{
|
||||
changeSelection(1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_LEFT)
|
||||
{
|
||||
changeDiff(-1);
|
||||
}
|
||||
if (gamepad.justPressed.DPAD_RIGHT)
|
||||
{
|
||||
changeDiff(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (upP)
|
||||
{
|
||||
changeSelection(-1);
|
||||
@ -197,9 +220,9 @@ class FreeplayState extends MusicBeatState
|
||||
changeSelection(1);
|
||||
}
|
||||
|
||||
if (controls.LEFT_P)
|
||||
if (FlxG.keys.justPressed.LEFT)
|
||||
changeDiff(-1);
|
||||
if (controls.RIGHT_P)
|
||||
if (FlxG.keys.justPressed.RIGHT)
|
||||
changeDiff(1);
|
||||
|
||||
if (controls.BACK)
|
||||
|
Reference in New Issue
Block a user