1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-18 18:47:48 +00:00

title tweaks:

fix crash when spamming enter,
force logo bump,
compensate for missed beats with intro text (ex. when window being dragged)
This commit is contained in:
MtH 2021-03-18 12:49:37 +01:00
parent 87ec716ade
commit 6e23041d8c
3 changed files with 59 additions and 55 deletions

View file

@ -9,9 +9,6 @@ import flixel.util.FlxTimer;
class MusicBeatState extends FlxUIState class MusicBeatState extends FlxUIState
{ {
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var curStep:Int = 0; private var curStep:Int = 0;
private var curBeat:Int = 0; private var curBeat:Int = 0;
private var controls(get, never):Controls; private var controls(get, never):Controls;

View file

@ -11,9 +11,6 @@ class MusicBeatSubstate extends FlxSubState
super(); super();
} }
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var curStep:Int = 0; private var curStep:Int = 0;
private var curBeat:Int = 0; private var curBeat:Int = 0;
private var controls(get, never):Controls; private var controls(get, never):Controls;

View file

@ -34,6 +34,8 @@ class TitleState extends MusicBeatState
var wackyImage:FlxSprite; var wackyImage:FlxSprite;
var lastBeat:Int = 0;
override public function create():Void override public function create():Void
{ {
#if polymod #if polymod
@ -304,7 +306,7 @@ class TitleState extends MusicBeatState
// FlxG.sound.play(Paths.music('titleShoot'), 0.7); // FlxG.sound.play(Paths.music('titleShoot'), 0.7);
} }
if (pressedEnter && !skippedIntro) if (pressedEnter && !skippedIntro && initialized)
{ {
skipIntro(); skipIntro();
} }
@ -346,7 +348,7 @@ class TitleState extends MusicBeatState
{ {
super.beatHit(); super.beatHit();
logoBl.animation.play('bump'); logoBl.animation.play('bump', true);
danceLeft = !danceLeft; danceLeft = !danceLeft;
if (danceLeft) if (danceLeft)
@ -355,8 +357,13 @@ class TitleState extends MusicBeatState
gfDance.animation.play('danceLeft'); gfDance.animation.play('danceLeft');
FlxG.log.add(curBeat); FlxG.log.add(curBeat);
// if the user is draggin the window some beats will
switch (curBeat) // be missed so this is just to compensate
if (curBeat > lastBeat)
{
for (i in lastBeat...curBeat)
{
switch (i + 1)
{ {
case 1: case 1:
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
@ -407,6 +414,9 @@ class TitleState extends MusicBeatState
skipIntro(); skipIntro();
} }
} }
}
lastBeat = curBeat;
}
var skippedIntro:Bool = false; var skippedIntro:Bool = false;