1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 07:27:12 +00:00

baby shit controller support

This commit is contained in:
Cameron Taylor 2020-10-09 00:29:00 -07:00
parent 7d925ae0ec
commit 65036334d2
3 changed files with 113 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.transition.FlxTransitionableState;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.input.gamepad.FlxGamepad;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
@ -37,7 +38,17 @@ class GameOverState extends FlxTransitionableState
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ANY && !fading)
var pressed:Bool = FlxG.keys.justPressed.ANY;
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.ANY)
pressed = true;
}
if (pressed && !fading)
{
fading = true;
FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween)

View file

@ -686,6 +686,70 @@ class PlayState extends FlxTransitionableState
var downR = FlxG.keys.anyJustReleased([S, DOWN]);
var leftR = FlxG.keys.anyJustReleased([A, LEFT]);
var gamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.anyPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
{
left = true;
}
if (gamepad.anyPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
{
right = true;
}
if (gamepad.anyPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
{
up = true;
}
if (gamepad.anyPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
{
down = true;
}
if (gamepad.anyJustPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
{
leftP = true;
}
if (gamepad.anyJustPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
{
rightP = true;
}
if (gamepad.anyJustPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
{
upP = true;
}
if (gamepad.anyJustPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
{
downP = true;
}
if (gamepad.anyJustReleased(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
{
leftR = true;
}
if (gamepad.anyJustReleased(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
{
rightR = true;
}
if (gamepad.anyJustReleased(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
{
upR = true;
}
if (gamepad.anyJustReleased(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
{
downR = true;
}
}
FlxG.watch.addQuick('asdfa', upP);
if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic)
{
@ -835,11 +899,36 @@ class PlayState extends FlxTransitionableState
function badNoteCheck()
{
// just double pasting this shit cuz fuk u
// REDO THIS SYSTEM!
var upP = FlxG.keys.anyJustPressed([W, UP]);
var rightP = FlxG.keys.anyJustPressed([D, RIGHT]);
var downP = FlxG.keys.anyJustPressed([S, DOWN]);
var leftP = FlxG.keys.anyJustPressed([A, LEFT]);
var gamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.anyJustPressed(["DPAD_LEFT", "LEFT_STICK_DIGITAL_LEFT", X]))
{
leftP = true;
}
if (gamepad.anyJustPressed(["DPAD_RIGHT", "LEFT_STICK_DIGITAL_RIGHT", B]))
{
rightP = true;
}
if (gamepad.anyJustPressed(['DPAD_UP', "LEFT_STICK_DIGITAL_UP", Y]))
{
upP = true;
}
if (gamepad.anyJustPressed(["DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN", A]))
{
downP = true;
}
}
if (leftP)
noteMiss(4);
if (upP)

View file

@ -8,6 +8,7 @@ import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond;
import flixel.addons.transition.FlxTransitionableState;
import flixel.addons.transition.TransitionData;
import flixel.graphics.FlxGraphic;
import flixel.input.gamepad.FlxGamepad;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.tweens.FlxEase;
@ -78,7 +79,17 @@ class TitleState extends FlxTransitionableState
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.ENTER && !transitioning)
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)
{
if (gamepad.justPressed.START)
pressedEnter = true;
}
if (pressedEnter && !transitioning)
{
FlxG.camera.flash(FlxColor.WHITE, 1);