From f70b581bf89694df96d2069e6f40d4e56a753617 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 17 Sep 2022 05:51:21 -0400 Subject: [PATCH] song event trace prototype --- source/funkin/TitleState.hx | 6 ++++-- source/funkin/noteStuff/NoteUtil.hx | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/source/funkin/TitleState.hx b/source/funkin/TitleState.hx index 465b2ddeb..85853444f 100644 --- a/source/funkin/TitleState.hx +++ b/source/funkin/TitleState.hx @@ -45,6 +45,7 @@ class TitleState extends MusicBeatState var video:Video; var netStream:NetStream; private var overlay:Sprite; + var songEventStuff:Map>; override public function create():Void { @@ -55,8 +56,7 @@ class TitleState extends MusicBeatState FlxG.sound.cache(Paths.music('freakyMenu')); var jsonThing:String = Paths.file('data/songs/bopeebo/bopeebo-events.json'); - var songstuffLol = NoteUtil.loadSongEvents(jsonThing); - trace(songstuffLol); + songEventStuff = NoteUtil.loadSongEvents(jsonThing); // DEBUG BULLSHIT @@ -270,6 +270,8 @@ class TitleState extends MusicBeatState override function update(elapsed:Float) { + NoteUtil.checkSongEvents(songEventStuff, Conductor.songPosition); + #if HAS_PITCH if (FlxG.keys.pressed.UP) FlxG.sound.music.pitch += 0.5 * elapsed; diff --git a/source/funkin/noteStuff/NoteUtil.hx b/source/funkin/noteStuff/NoteUtil.hx index 71507355c..054ec2fef 100644 --- a/source/funkin/noteStuff/NoteUtil.hx +++ b/source/funkin/noteStuff/NoteUtil.hx @@ -59,7 +59,20 @@ class NoteUtil { for (eventGrp in songData.keys()) { - trace(eventGrp); + if (time >= eventGrp) + { + for (events in songData[eventGrp]) + { + if (!events.activated) + { + // TURN TO NICER SWITCH STATEMENT CHECKER OF EVENT TYPES!! + trace(events.value); + trace(eventGrp); + trace(Conductor.songPosition); + events.activated = true; + } + } + } } } }