Skip to content

Commit

Permalink
Instant Respawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Catbrother-Everything committed Aug 8, 2021
1 parent c69e83d commit 24acbc5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
10 changes: 10 additions & 0 deletions source/GameOverState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions source/GameOverSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions source/KadeEngineData.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 21 additions & 0 deletions source/Options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions source/OptionsMenu.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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")
]),
Expand Down

0 comments on commit 24acbc5

Please sign in to comment.