Skip to content

Commit

Permalink
Prevent double GAME_OVER events on playback completion.
Browse files Browse the repository at this point in the history
  • Loading branch information
bvanvugt committed Oct 25, 2023
1 parent 68fa438 commit 741e7ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/playback/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ const setCurrentFrame = (index: number) => {
$state.frame = newFrame;

if ($state.frame.isFinalFrame && $state.mode == PlaybackMode.PLAYING) {
controls.pause();
stopPlayback();
$state.mode = PlaybackMode.PAUSED;
if (settings.loop) {
setTimeout(controls.firstFrame, LOOP_DELAY_MS);
setTimeout(controls.play, LOOP_DELAY_MS * 2);
Expand Down

0 comments on commit 741e7ee

Please sign in to comment.