1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-23 13:07:07 +00:00

MAYBE DOIN CHART SHIT?

This commit is contained in:
Cameron Taylor 2020-11-21 02:43:04 -08:00
parent 4e9afb528c
commit 3529fbd25f
3 changed files with 31 additions and 2 deletions

View file

@ -384,6 +384,8 @@ class ChartingState extends MusicBeatState
override function update(elapsed:Float) override function update(elapsed:Float)
{ {
curStep = recalculateSteps();
Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition = FlxG.sound.music.time;
_song.song = typingShit.text; _song.song = typingShit.text;
@ -520,6 +522,28 @@ class ChartingState extends MusicBeatState
super.update(elapsed); 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 function changeSection(sec:Int = 0, ?updateMusic:Bool = true):Void
{ {
trace('changing section' + sec); trace('changing section' + sec);

View file

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

View file

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