From 24acbc5f7477e79fdb50d80cc6163d6395183f99 Mon Sep 17 00:00:00 2001 From: Lil-Parrot Date: Sun, 8 Aug 2021 00:10:12 -0500 Subject: [PATCH] Instant Respawn --- source/GameOverState.hx | 10 ++++++++++ source/GameOverSubstate.hx | 5 +++++ source/KadeEngineData.hx | 3 +++ source/Options.hx | 21 +++++++++++++++++++++ source/OptionsMenu.hx | 1 + 5 files changed, 40 insertions(+) diff --git a/source/GameOverState.hx b/source/GameOverState.hx index c26c063..8da12b3 100644 --- a/source/GameOverState.hx +++ b/source/GameOverState.hx @@ -60,6 +60,16 @@ class GameOverState extends FlxTransitionableState var gamepad:FlxGamepad = FlxG.gamepads.lastActive; + if(FlxG.save.data.InstantRespawn) + { + fading = true; + FlxG.sound.music.fadeOut(0.5, 0, function(twn:FlxTween) + { + FlxG.sound.music.stop(); + LoadingState.loadAndSwitchState(new PlayState()); + }); + } + if (gamepad != null) { if (gamepad.justPressed.ANY) diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 8a840b3..3fce8cb 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -59,6 +59,11 @@ class GameOverSubstate extends MusicBeatSubstate endBullshit(); } + if(FlxG.save.data.InstantRespawn) + { + LoadingState.loadAndSwitchState(new PlayState()); + } + if (controls.BACK) { FlxG.sound.music.stop(); diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 78d86e4..f485779 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -75,6 +75,9 @@ class KadeEngineData if (FlxG.save.data.resetButton == null) FlxG.save.data.resetButton = false; + + if (FlxG.save.data.InstantRespawn == null) + FlxG.save.data.InstantRespawn = false; if (FlxG.save.data.botplay == null) FlxG.save.data.botplay = false; diff --git a/source/Options.hx b/source/Options.hx index 10eb0b0..35805f3 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -284,6 +284,27 @@ class ResetButtonOption extends Option } } +class InstantRespawn extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.InstantRespawn = !FlxG.save.data.InstantRespawn; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return "Instant Respawn " + (!FlxG.save.data.InstantRespawn ? "off" : "on"); + } +} + class FlashingLightsOption extends Option { public function new(desc:String) diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index f953f01..ea02dff 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -36,6 +36,7 @@ class OptionsMenu extends MusicBeatState new ScrollSpeedOption("Change your scroll speed (1 = Chart dependent)"), new AccuracyDOption("Change how accuracy is calculated. (Accurate = Simple, Complex = Milisecond Based)"), new ResetButtonOption("Toggle pressing R to gameover."), + new InstantRespawn("Toggle if you instantly respawn after dying."), // new OffsetMenu("Get a note offset based off of your inputs!"), new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference") ]),