1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-04 13:54:22 +00:00

latency stuff in progress maybe?

This commit is contained in:
Cameron Taylor 2022-07-05 14:24:02 -04:00
parent 3f84a5514f
commit b5d85c3fd6
3 changed files with 24 additions and 8 deletions

View file

@ -179,11 +179,9 @@ class InitState extends FlxTransitionableState
#elseif FIGHT
FlxG.switchState(new PicoFight());
#elseif ANIMDEBUG
<<<<<<< HEAD
FlxG.switchState(new funkin.ui.animDebugShit.DebugBoundingState());
=======
FlxG.switchState(new DebugBoundingState());
>>>>>>> origin/feature/scripted-modules
#elseif LATENCY
FlxG.switchState(new LatencyState());
#elseif NETTEST
FlxG.switchState(new netTest.NetTest());
#else

View file

@ -1,16 +1,18 @@
package funkin;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.FlxSubState;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
class LatencyState extends FlxState
class LatencyState extends MusicBeatSubstate
{
var offsetText:FlxText;
var noteGrp:FlxTypedGroup<Note>;
var strumLine:FlxSprite;
var block:FlxSprite;
override function create()
{
FlxG.sound.playMusic(Paths.sound('soundTest'));
@ -18,6 +20,9 @@ class LatencyState extends FlxState
noteGrp = new FlxTypedGroup<Note>();
add(noteGrp);
block = new FlxSprite().makeGraphic(100, 100);
add(block);
for (i in 0...32)
{
var note:Note = new Note(Conductor.crochet * i, 1);
@ -36,6 +41,13 @@ class LatencyState extends FlxState
super.create();
}
override function beatHit()
{
block.visible = !block.visible;
super.beatHit();
}
override function update(elapsed:Float)
{
offsetText.text = "Offset: " + Conductor.offset + "ms";
@ -65,7 +77,13 @@ class LatencyState extends FlxState
daNote.x = strumLine.x + 30;
if (daNote.y < strumLine.y)
daNote.kill();
daNote.alpha = 0.5;
if (daNote.y < 0 - daNote.height)
{
daNote.alpha = 1;
// daNote.data.strumTime += Conductor.crochet * 8;
}
});
super.update(elapsed);

View file

@ -45,7 +45,7 @@ class MusicBeatSubstate extends FlxSubState
}
for (i in 0...Conductor.bpmChangeMap.length)
{
if (Conductor.songPosition > Conductor.bpmChangeMap[i].songTime)
if (Conductor.songPosition - Conductor.offset > Conductor.bpmChangeMap[i].songTime)
lastChange = Conductor.bpmChangeMap[i];
}