mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 08:07:54 -05:00
54 lines
1.1 KiB
Haxe
54 lines
1.1 KiB
Haxe
|
package;
|
||
|
|
||
|
import flixel.addons.transition.FlxTransitionableState;
|
||
|
|
||
|
class MusicBeatState extends FlxTransitionableState
|
||
|
{
|
||
|
private var lastBeat:Float = 0;
|
||
|
private var lastStep:Float = 0;
|
||
|
|
||
|
private var totalBeats:Int = 0;
|
||
|
private var totalSteps:Int = 0;
|
||
|
|
||
|
override function create()
|
||
|
{
|
||
|
super.create();
|
||
|
}
|
||
|
|
||
|
private function everyBeat():Void
|
||
|
{
|
||
|
if (Conductor.songPosition > lastBeat + Conductor.crochet - Conductor.safeZoneOffset
|
||
|
|| Conductor.songPosition < lastBeat + Conductor.safeZoneOffset)
|
||
|
{
|
||
|
if (Conductor.songPosition > lastBeat + Conductor.crochet)
|
||
|
{
|
||
|
beatHit();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private function everyStep():Void
|
||
|
{
|
||
|
if (Conductor.songPosition > lastStep + Conductor.stepCrochet - Conductor.safeZoneOffset
|
||
|
|| Conductor.songPosition < lastStep + Conductor.safeZoneOffset)
|
||
|
{
|
||
|
if (Conductor.songPosition > lastStep + Conductor.stepCrochet)
|
||
|
{
|
||
|
stepHit();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function stepHit():Void
|
||
|
{
|
||
|
totalSteps += 1;
|
||
|
lastStep += Conductor.stepCrochet;
|
||
|
}
|
||
|
|
||
|
public function beatHit():Void
|
||
|
{
|
||
|
lastBeat += Conductor.crochet;
|
||
|
totalBeats += 1;
|
||
|
}
|
||
|
}
|