A
ArtCode
Guest
Hello folks!
I'm trying to insert some ADs in my game! Well I want them to appear only when the game goes in PAUSE state.
To this moment the AD does appear when I'm entering in the state of PAUSE but when I resume the game the AD doesnt go off... it stays there :/
Here is my code:
The AD is handled by another OBJECT which is the PAUSE BUTTON ...
obj_Pause_Button
Mouse_Left_Pressed EVENT:
Script 1
Script 2
Than I created 2 objects for the ADs
obj_LoadAds
START GAME Event
obj_BannerAd
CREATE Event
This one is for creating a Banner AD after the AD is loaded. Don't worry, that AD Id is the TEST from the AdMob website.
The scripts are simple but I dont understand why the BANNER doesnt destroy if I say so...
I'm trying to insert some ADs in my game! Well I want them to appear only when the game goes in PAUSE state.
To this moment the AD does appear when I'm entering in the state of PAUSE but when I resume the game the AD doesnt go off... it stays there :/
Here is my code:
The AD is handled by another OBJECT which is the PAUSE BUTTON ...
obj_Pause_Button
Mouse_Left_Pressed EVENT:
Script 1
Code:
global.isPaused = !global.isPaused;
// Some other code is here but its not important
Code:
if(global.isPaused){
instance_create(0,0,obj_BannerAd);
}
if (!global.isPaused){
with(obj_BannerAd) instance_destroy();
}
obj_LoadAds
START GAME Event
Code:
GoogleMobileAds_Init("ca-app-pub-3940256099942544/6300978111");
CREATE Event
Code:
GoogleMobileAds_AddBannerAt("ca-app-pub-3940256099942544/6300978111", GoogleMobileAds_Banner, 0, view_yview + 1210 );
The scripts are simple but I dont understand why the BANNER doesnt destroy if I say so...