Fix Steps

This commit is contained in:
Kade M
2021-08-02 17:03:00 -07:00
committed by GitHub
parent 121e1c0d70
commit fc0a08ed53

View File

@ -49,7 +49,7 @@ class MusicBeatState extends FlxUIState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
//everyStep(); //everyStep();
var nextStep:Int = updateCurStep(); /*var nextStep:Int = updateCurStep();
if (nextStep >= 0) if (nextStep >= 0)
{ {
@ -69,7 +69,7 @@ class MusicBeatState extends FlxUIState
updateBeat(); updateBeat();
stepHit(); stepHit();
} }
} }*/
if (Conductor.songPosition < 0) if (Conductor.songPosition < 0)
curDecimalBeat = 0; curDecimalBeat = 0;
@ -83,17 +83,62 @@ class MusicBeatState extends FlxUIState
Conductor.crochet = ((60 / data.bpm) * 1000); Conductor.crochet = ((60 / data.bpm) * 1000);
var percent = (Conductor.songPosition - (data.startTime * 1000)) / (data.length * 1000); var step = ((60 / data.bpm) * 1000) / 4;
var startInMS = (data.startTime * 1000);
var percent = (Conductor.songPosition - startInMS) / (data.length * 1000);
curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60)); curDecimalBeat = data.startBeat + (((Conductor.songPosition/1000) - data.startTime) * (data.bpm / 60));
var ste:Int = Math.floor(data.startStep + ((Conductor.songPosition - startInMS) / step));
if (ste >= 0)
{
if (ste > curStep)
{
for (i in curStep...ste)
{
curStep++;
updateBeat();
stepHit();
}
}
else if (ste < curStep)
{
//Song reset?
curStep = ste;
updateBeat();
stepHit();
}
}
} }
else else
{ {
curDecimalBeat = (Conductor.songPosition / 1000) * (Conductor.bpm/60); curDecimalBeat = (Conductor.songPosition / 1000) * (Conductor.bpm/60);
var nextStep:Int = Math.floor(Conductor.songPosition / Conductor.stepCrochet);
if (nextStep >= 0)
{
if (nextStep > curStep)
{
for (i in curStep...nextStep)
{
curStep++;
updateBeat();
stepHit();
}
}
else if (nextStep < curStep)
{
//Song reset?
curStep = nextStep;
updateBeat();
stepHit();
}
}
Conductor.crochet = ((60 / Conductor.bpm) * 1000); Conductor.crochet = ((60 / Conductor.bpm) * 1000);
} }
} }
if (FlxG.save.data.fpsRain && skippedFrames >= 6) if (FlxG.save.data.fpsRain && skippedFrames >= 6)
{ {
if (currentColor >= array.length) if (currentColor >= array.length)