Skip to content

Commit

Permalink
okay callbacks *work* properly now
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie-coder committed Jan 12, 2025
1 parent 301215d commit ad8c15e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
12 changes: 7 additions & 5 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions source/StartupState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ 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);

trace('This might not work! YAY :DDDDD');

insert(0, vidSprite);
vidSprite.play();

if (callback != null)
callback();
#else
FlxG.log.warn('Platform not supported!');
if (callback != null)
Expand Down

0 comments on commit ad8c15e

Please sign in to comment.