1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-25 14:46:43 +00:00

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