MAYBE DOIN CHART SHIT?

This commit is contained in:
Cameron Taylor 2020-11-21 02:43:04 -08:00
parent 8c8f234fb3
commit cb0ebfdbe1
3 changed files with 31 additions and 2 deletions

View File

@ -384,6 +384,8 @@ class ChartingState extends MusicBeatState
override function update(elapsed:Float)
{
curStep = recalculateSteps();
Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text;
@ -520,6 +522,28 @@ class ChartingState extends MusicBeatState
super.update(elapsed);
}
function recalculateSteps():Int
{
var steps:Int = 0;
var timeShit:Float = 0;
for (i in 0...curSection)
{
steps += 16;
if (_song.notes[i].changeBPM)
timeShit += (((60 / _song.notes[i].bpm) * 1000) / 4) * 16;
else
timeShit += (((60 / _song.bpm) * 1000) / 4) * 16;
}
steps += Math.floor((FlxG.sound.music.time - timeShit) / Conductor.stepCrochet);
curStep = steps;
updateBeat();
return curStep;
}
function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void
{
trace('changing section' + sec);

View File

@ -35,11 +35,16 @@ class MusicBeatState extends FlxUIState
updateCurStep();
// Needs to be ROUNED, rather than ceil or floor
curBeat = Math.round(curStep / 4);
updateBeat();
super.update(elapsed);
}
private function updateBeat():Void
{
curBeat = Math.round(curStep / 4);
}
/**
* CHECKS EVERY FRAME
*/

View File

@ -68,7 +68,7 @@ class TitleState extends MusicBeatState
}
#if SKIP_TO_PLAYSTATE
FlxG.switchState(new FreeplayState());
FlxG.switchState(new ChartingState());
#else
startIntro();
#end