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 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,57 +357,65 @@ 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)
{ {
case 1: for (i in lastBeat...curBeat)
createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); {
// credTextShit.visible = true; switch (i + 1)
case 3: {
addMoreText('present'); case 1:
// credTextShit.text += '\npresent...'; createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']);
// credTextShit.addText(); // credTextShit.visible = true;
case 4: case 3:
deleteCoolText(); addMoreText('present');
// credTextShit.visible = false; // credTextShit.text += '\npresent...';
// credTextShit.text = 'In association \nwith'; // credTextShit.addText();
// credTextShit.screenCenter(); case 4:
case 5: deleteCoolText();
createCoolText(['In association', 'with']); // credTextShit.visible = false;
case 7: // credTextShit.text = 'In association \nwith';
addMoreText('newgrounds'); // credTextShit.screenCenter();
ngSpr.visible = true; case 5:
// credTextShit.text += '\nNewgrounds'; createCoolText(['In association', 'with']);
case 8: case 7:
deleteCoolText(); addMoreText('newgrounds');
ngSpr.visible = false; ngSpr.visible = true;
// credTextShit.visible = false; // credTextShit.text += '\nNewgrounds';
case 8:
deleteCoolText();
ngSpr.visible = false;
// credTextShit.visible = false;
// credTextShit.text = 'Shoutouts Tom Fulp'; // credTextShit.text = 'Shoutouts Tom Fulp';
// credTextShit.screenCenter(); // credTextShit.screenCenter();
case 9: case 9:
createCoolText([curWacky[0]]); createCoolText([curWacky[0]]);
// credTextShit.visible = true; // credTextShit.visible = true;
case 11: case 11:
addMoreText(curWacky[1]); addMoreText(curWacky[1]);
// credTextShit.text += '\nlmao'; // credTextShit.text += '\nlmao';
case 12: case 12:
deleteCoolText(); deleteCoolText();
// credTextShit.visible = false; // credTextShit.visible = false;
// credTextShit.text = "Friday"; // credTextShit.text = "Friday";
// credTextShit.screenCenter(); // credTextShit.screenCenter();
case 13: case 13:
addMoreText('Friday'); addMoreText('Friday');
// credTextShit.visible = true; // credTextShit.visible = true;
case 14: case 14:
addMoreText('Night'); addMoreText('Night');
// credTextShit.text += '\nNight'; // credTextShit.text += '\nNight';
case 15: case 15:
addMoreText('Funkin'); // credTextShit.text += '\nFunkin'; addMoreText('Funkin'); // credTextShit.text += '\nFunkin';
case 16: case 16:
skipIntro(); skipIntro();
}
}
} }
lastBeat = curBeat;
} }
var skippedIntro:Bool = false; var skippedIntro:Bool = false;