gamepad support and keybind cleaning up

This commit is contained in:
Kade M
2021-06-24 19:54:11 -07:00
parent 5432d66601
commit 06ca64b5d8
13 changed files with 424 additions and 150 deletions

View File

@ -1,5 +1,6 @@
package;
import flixel.input.gamepad.FlxGamepad;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
@ -222,12 +223,44 @@ class StoryMenuState extends MusicBeatState
{
if (!selectedWeek)
{
if (controls.UP_P)
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.DPAD_UP)
{
changeWeek(-1);
}
if (gamepad.justPressed.DPAD_DOWN)
{
changeWeek(1);
}
if (gamepad.pressed.DPAD_RIGHT)
rightArrow.animation.play('press')
else
rightArrow.animation.play('idle');
if (gamepad.pressed.DPAD_LEFT)
leftArrow.animation.play('press');
else
leftArrow.animation.play('idle');
if (gamepad.justPressed.DPAD_RIGHT)
{
changeDifficulty(1);
}
if (gamepad.justPressed.DPAD_LEFT)
{
changeDifficulty(-1);
}
}
if (FlxG.keys.justPressed.UP)
{
changeWeek(-1);
}
if (controls.DOWN_P)
if (FlxG.keys.justPressed.DOWN)
{
changeWeek(1);
}