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 d662291f79
commit 4ef634ec2c
3 changed files with 59 additions and 55 deletions

View File

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

View File

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

View File

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