From b5d85c3fd622629af112dd21992ace0074335f41 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Tue, 5 Jul 2022 14:24:02 -0400 Subject: [PATCH] latency stuff in progress maybe? --- source/funkin/InitState.hx | 6 ++---- source/funkin/LatencyState.hx | 24 +++++++++++++++++++++--- source/funkin/MusicBeatSubstate.hx | 2 +- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index bfde8c327..07dcd2afb 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -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 diff --git a/source/funkin/LatencyState.hx b/source/funkin/LatencyState.hx index 0239bea53..b7e559beb 100644 --- a/source/funkin/LatencyState.hx +++ b/source/funkin/LatencyState.hx @@ -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); diff --git a/source/funkin/MusicBeatSubstate.hx b/source/funkin/MusicBeatSubstate.hx index db20bce34..001f8d420 100644 --- a/source/funkin/MusicBeatSubstate.hx +++ b/source/funkin/MusicBeatSubstate.hx @@ -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]; }