1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-23 15:26:06 +00:00

switch setup start [REAL]

This commit is contained in:
Brandon 2020-10-26 19:06:42 -04:00
parent 02b751d8fb
commit 32df13aedf
2 changed files with 31 additions and 1 deletions

View file

@ -25,6 +25,9 @@
<!--Mobile-specific--> <!--Mobile-specific-->
<window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" /> <window if="mobile" orientation="landscape" fullscreen="true" width="0" height="0" />
<!--Switch-specific-->
<window if="switch" orientation="landscape" fullscreen="true" width="0" height="0" resizable="true" />
<!-- _____________________________ Path Settings ____________________________ --> <!-- _____________________________ Path Settings ____________________________ -->
<set name="BUILD_DIR" value="export/debug" if="debug" /> <set name="BUILD_DIR" value="export/debug" if="debug" />
@ -91,5 +94,6 @@
<!-- _________________________________ Custom _______________________________ --> <!-- _________________________________ Custom _______________________________ -->
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)--> <!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->
<icon path="art/icon.png"/> <icon path="art/icon.png" unless="switch" />
<icon path="art/iconSwitch.png" if="switch" />
</project> </project>

View file

@ -5,6 +5,13 @@ import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay; import flixel.addons.display.FlxGridOverlay;
import flixel.text.FlxText; import flixel.text.FlxText;
#if switch
import openfl.events.GameInputEvent;
import openfl.ui.GameInput;
import openfl.ui.GameInputDevice;
import openfl.ui.GameInputControl;
#end
class FreeplayState extends MusicBeatState class FreeplayState extends MusicBeatState
{ {
var songs:Array<String> = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial\nlol"]; var songs:Array<String> = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial\nlol"];
@ -48,6 +55,17 @@ class FreeplayState extends MusicBeatState
curSelected += 1; curSelected += 1;
} }
#if switch
if (gamepad.anyJustPressed(["UP", "DPAD_UP", "LEFT_STICK_DIGITAL_UP"]))
{
curSelected -= 1;
}
if (gamepad.anyJustPressed(["DOWN", "DPAD_DOWN", "LEFT_STICK_DIGITAL_DOWN"]))
{
curSelected += 1;
}
#end
if (curSelected < 0) if (curSelected < 0)
curSelected = songs.length - 1; curSelected = songs.length - 1;
if (curSelected >= songs.length) if (curSelected >= songs.length)
@ -61,6 +79,14 @@ class FreeplayState extends MusicBeatState
FlxG.switchState(new PlayState()); FlxG.switchState(new PlayState());
} }
#if switch
if (gamepad.anyJustPressed(["B"])) //"B" is swapped with "A" on Switch
{
PlayState.SONG = Song.loadFromJson(songs[curSelected].toLowerCase());
FlxG.switchState(new PlayState());
}
#end
super.update(elapsed); super.update(elapsed);
} }
} }