entirely phase out totalBeats/totalSteps in favor of the more reliable curStep/curBeat

This commit is contained in:
MtH
2021-02-12 03:19:27 +01:00
parent 7d0f5c4045
commit e4f17360b6
3 changed files with 17 additions and 40 deletions

View File

@ -14,9 +14,6 @@ class MusicBeatSubstate extends FlxSubState
private var lastBeat:Float = 0;
private var lastStep:Float = 0;
private var totalBeats:Int = 0;
private var totalSteps:Int = 0;
private var curStep:Int = 0;
private var curBeat:Int = 0;
private var controls(get, never):Controls;
@ -39,11 +36,11 @@ class MusicBeatSubstate extends FlxSubState
var oldStep:Int = curStep;
updateCurStep();
curBeat = Math.floor(curStep / 4);
if (oldStep != curStep && curStep > 0)
stepHit();
curBeat = Math.floor(curStep / 4);
super.update(elapsed);
}
@ -66,16 +63,12 @@ class MusicBeatSubstate extends FlxSubState
public function stepHit():Void
{
totalSteps += 1;
lastStep += Conductor.stepCrochet;
if (totalSteps % 4 == 0)
if (curStep % 4 == 0)
beatHit();
}
public function beatHit():Void
{
lastBeat += Conductor.crochet;
totalBeats += 1;
//do literally nothing dumbass
}
}