Skip to content

Commit

Permalink
fixed crash killing myself
Browse files Browse the repository at this point in the history
  • Loading branch information
x8c8r committed Jun 25, 2024
1 parent cb72b46 commit c27c983
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class FreeplayState extends MusicBeatState
PlayState.storyDifficulty = diff;

PlayState.storyWeek = storyWeek;
trace('CUR WEEK' + PlayState.storyWeek);
// trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
}

Expand Down
4 changes: 2 additions & 2 deletions source/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class MusicBeatState extends FlxUIState

override function create()
{
if (transIn != null)
trace('reg ' + transIn.region);
// if (transIn != null)
// trace('reg ' + transIn.region);

super.create();
}
Expand Down
3 changes: 0 additions & 3 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ class PlayState extends MusicBeatState
if (FlxG.save.data.beatSongs != null) {
if (!FlxG.save.data.beatSongs.contains(curSong.toLowerCase))
FlxG.save.data.beatSongs.push(curSong.toLowerCase());
#if debug
trace(curSong.toLowerCase());
#end
}

Conductor.mapBPMChanges(SONG);
Expand Down
40 changes: 33 additions & 7 deletions source/ResultsSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ class ResultsSubState extends MusicBeatSubstate {

var music:FlxSound;
var judgement:FlxSound;

var textTimer:FlxTimer;
var soundTimer:FlxTimer;
var judgementTimer:FlxTimer;

var textTween:FlxTween;
var bgTween:FlxTween;
var judgementTween:FlxTween;

var canExit:Bool = false;

public function new(x:Float, y:Float, results:FunkinResults, playState:PlayState) {
super();
Expand All @@ -52,6 +62,7 @@ class ResultsSubState extends MusicBeatSubstate {
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);
bgTween = FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});

var exitText = new FlxText(-150, FlxG.height - 150, 0, "Press ENTER to finish", 24, false);
exitText.setFormat(Paths.font("vcr.ttf"), 24, FlxColor.WHITE, FlxTextAlign.LEFT);
Expand Down Expand Up @@ -91,14 +102,15 @@ class ResultsSubState extends MusicBeatSubstate {
add(texts);

for (i in 0... texts.length) {
new FlxTimer().start(0.1 * (i+1), (timer:FlxTimer) -> {
FlxTween.tween(texts.members[i], {alpha: 1, x: 50}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3});
textTimer = new FlxTimer().start(0.1 * (i+1), (timer:FlxTimer) -> {
trace(texts.members[i]);
textTween = FlxTween.tween(texts.members[i], {alpha: 1, x: 50}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3}).start();
});
new FlxTimer().start(0.3 + (0.1*(i + 1)), (timer:FlxTimer) -> {
soundTimer = new FlxTimer().start(0.3 + (0.1*(i + 1)), (timer:FlxTimer) -> {
FlxG.sound.play(Paths.sound('scrollMenu'));
});
};
new FlxTimer().start(0.4 + (0.1*texts.length), (timer:FlxTimer) -> {
judgementTimer = new FlxTimer().start(0.4 + (0.1*texts.length), (timer:FlxTimer) -> {
var selectedJudgement:String = "";
if (results.accuracy == 100)
selectedJudgement = "pfc";
Expand All @@ -112,17 +124,31 @@ class ResultsSubState extends MusicBeatSubstate {
selectedJudgement = "shit";
else
selectedJudgement = "worst";
FlxTween.tween(music, {"volume": 0}, 4, {ease: FlxEase.linear});

if (music != null)
judgementTween = FlxTween.tween(music, {"volume": 0}, 4, {ease: FlxEase.linear}).start();

judgement = new FlxSound().loadEmbedded(Paths.sound('judgements/'+selectedJudgement), false, true).play();
judgement.volume = 0.5;

canExit = true;
});
FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});

}

override function update(elapsed:Float) {
if (FlxG.keys.justPressed.ENTER) {
if (FlxG.keys.justPressed.ENTER && canExit) {
// textTimer.cancel();
// soundTimer.cancel();
// judgementTimer.cancel();

// if (textTween != null)
// textTween.cancel();
// if (bgTween != null)
// bgTween.cancel();
// if (judgementTween != null)
// judgementTween.cancel();

playState.wakeTheFuckUp();
music.destroy();
judgement.destroy();
Expand Down

0 comments on commit c27c983

Please sign in to comment.