diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index 8d85b316e..fd385b9b9 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -22,6 +22,9 @@ import funkin.effects.RetroCameraFade; import flixel.math.FlxPoint; import funkin.util.TouchUtil; import openfl.utils.Assets; +#if FEATURE_MOBILE_ADVERTISEMENTS +import funkin.mobile.util.AdMobUtil; +#end /** * A substate which renders over the PlayState when the player dies. @@ -408,13 +411,32 @@ class GameOverSubState extends MusicBeatSubState RetroCameraFade.fadeToBlack(FlxG.camera, 10, 2); new FlxTimer().start(2, _ -> { FlxG.camera.filters = []; + + #if FEATURE_MOBILE_ADVERTISEMENTS + if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0) + { + AdMobUtil.loadInterstitial(resetPlaying.bind(true)); + } + else + resetPlaying(true); + #else resetPlaying(true); + #end }); } else { FlxG.camera.fade(FlxColor.BLACK, 2, false, function() { + #if FEATURE_MOBILE_ADVERTISEMENTS + if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0) + { + AdMobUtil.loadInterstitial(resetPlaying.bind()); + } + else + resetPlaying(); + #else resetPlaying(); + #end }); } }); diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index fc125ca81..987495494 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1250,34 +1250,6 @@ class PlayState extends MusicBeatSubState if (iconP2 != null) iconP2.updatePosition(); } - #if FEATURE_MOBILE_ADVERTISEMENTS - if (Constants.GLOBAL_BLUEBALL_COUNTER > 0 && Constants.GLOBAL_BLUEBALL_COUNTER % 3 == 0) - { - AdMobUtil.loadInterstitial(function():Void { - // Transition to the game over substate. - var gameOverSubState = new GameOverSubState( - { - isChartingMode: isChartingMode, - transparent: persistentDraw - }); - FlxTransitionableState.skipNextTransIn = true; - FlxTransitionableState.skipNextTransOut = true; - openSubState(gameOverSubState); - }); - } - else - { - // Transition to the game over substate. - var gameOverSubState = new GameOverSubState( - { - isChartingMode: isChartingMode, - transparent: persistentDraw - }); - FlxTransitionableState.skipNextTransIn = true; - FlxTransitionableState.skipNextTransOut = true; - openSubState(gameOverSubState); - } - #else // Transition to the game over substate. var gameOverSubState = new GameOverSubState( { @@ -1287,7 +1259,6 @@ class PlayState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; openSubState(gameOverSubState); - #end } function processSongEvents():Void