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 Controls.KeyboardScheme;
import flixel.FlxG;
import flixel.FlxObject;
@ -144,13 +145,29 @@ class MainMenuState extends MusicBeatState
if (!selectedSomethin)
{
if (controls.UP_P)
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.DPAD_UP)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(-1);
}
if (gamepad.justPressed.DPAD_DOWN)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(1);
}
}
if (FlxG.keys.justPressed.UP)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(-1);
}
if (controls.DOWN_P)
if (FlxG.keys.justPressed.DOWN)
{
FlxG.sound.play(Paths.sound('scrollMenu'));
changeItem(1);