From ad8c15eb60dce5d1fa56ad1cdb53d287096b66c9 Mon Sep 17 00:00:00 2001 From: Moxie <124418090+moxie-coder@users.noreply.github.com> Date: Sun, 12 Jan 2025 09:02:39 -0500 Subject: [PATCH] okay callbacks *work* properly now --- source/PlayState.hx | 12 +++++++----- source/StartupState.hx | 8 ++++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 9c41ed94884..7e3eed33ba5 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1958,7 +1958,13 @@ class PlayState extends MusicBeatState videoCutscene.screenCenter(); } }); - videoCutscene.bitmap.onEndReached.add(videoCutscene.destroy); + videoCutscene.bitmap.onEndReached.add(function(){ + videoCutscene.destroy(); + if (callback != null) + callback(); + else + startAndEnd(); + }); videoCutscene.load(filepath); function startAndEnd() @@ -1971,10 +1977,6 @@ class PlayState extends MusicBeatState add(videoCutscene); videoCutscene.play(); - if (callback != null) - callback(); - else - startAndEnd(); #else FlxG.log.warn('Platform not supported!'); if (callback != null) diff --git a/source/StartupState.hx b/source/StartupState.hx index ccc28e15258..fc2c42bc7f9 100644 --- a/source/StartupState.hx +++ b/source/StartupState.hx @@ -51,7 +51,10 @@ class StartupState extends MusicBeatState }); vidSprite.bitmap.onEndReached.add(function(){ vidSprite.destroy(); - FlxG.switchState(TitleState.new); + if (callback != null) + callback(); + else + FlxG.switchState(TitleState.new); }); vidSprite.load(filepath); @@ -59,9 +62,6 @@ class StartupState extends MusicBeatState insert(0, vidSprite); vidSprite.play(); - - if (callback != null) - callback(); #else FlxG.log.warn('Platform not supported!'); if (callback != null)