Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oCtrlAdd.Create Event
- globalvar money;
- money = 0;
- rewarded_viewed = "";
- //Check what OS the client is running - Set ID's from ADmob.
- if os_type == os_android
- {
- app_id = "ca-app-pub-4337965814269841~8766033236";
- interstitial_id = "ca-app-pub-3940256099942544/8691691433";
- banner_id = "ca-app-pub-3202039677277756/8024372905";
- rewarded_id = "ca-app-pub-3202039677277756/9445567106";
- }
- //Initialize googlemobileads
- GoogleMobileAds_Init(interstitial_id, app_id);
- GoogleMobileAds_LoadInterstitial();
- interstitial_loaded = false;
- //get the video & load it
- GoogleMobileAds_LoadRewardedVideo(rewarded_id);
- //use test ads as to not get banned by admob
- GoogleMobileAds_UseTestAds(true, "E3DAE5ACB5072BA36197B94E287927C9");
- //add banner
- GoogleMobileAds_AddBanner(banner_id,GoogleMobileAds_Banner);
- //add banner @ location
- /*
- GoogleMobileAds_AddBannerAt(banner_id,GoogleMobileAds_Banner,x,y);
- */
- oCtrlAdd.Step Event
- //Check if interstitial is loaded, if it is, show the interstitial ad
- if interstitial_loaded == true
- {
- interstitial_loaded = false;
- GoogleMobileAds_ShowInterstitial();
- }
- oCtrlAdd.Draw GUI Event
- /// @description Insert description here
- // You can write your code in this editor
- draw_set_halign(fa_center);
- draw_set_valign(fa_center);
- draw_set_color(c_white);
- draw_set_font(font0);
- draw_text(room_width / 2, room_height / 2, money);
- oCtrlAdd.Async-Social Event
- /// @description Insert description here
- // You can write your code in this editor
- //handle rezising of the Banner by grabbing the height & width from both GoogleMobileAds & client-side
- var _id = async_load[? "type"];
- if _id == GoogleMobileAds_ASyncEvent
- {
- var ident = async_load[? "type"] == 1
- switch (ident)
- {
- case "banner_load":
- if async_load[? "loaded"] == 1
- {
- var _bw = GoogleMobileAds_BannerGetWidth();
- var _bh = GoogleMobileAds_BannerGetHeight();
- var _hh = display_get_height();
- var _ww = display_get_width();
- GoogleMobileAds_MoveBanner((_ww / 2) - (_bw / 2), _hh - _bh);
- }
- break;
- }
- }
- //rewarded ads
- var ident2 = async_load[? "type"];
- switch (ident2)
- {
- case "rewardedvideo_adopened":
- show_debug_message("Rewards Video Opened");
- break;
- case "rewardedvideo_videostarted":
- show_debug_message("Rewards Video Started");
- break;
- case "rewardedvideo_watched":
- show_debug_message("Rewards Video Watched");
- rewarded_viewed = true;
- money += async_load[? "amount"];
- break;
- case "rewardedvideo_adclosed":
- show_debug_message("Rewards Video Closed");
- if rewarded_viewed = false
- {
- //Video was closed before the end
- }
- else
- {
- rewarded_viewed = false;
- }
- GoogleMobileAds_LoadRewardedVideo("rewarded_id");
- break;
- }
- oInterstitial.Draw GUI Event
- /// @description Insert description here
- // You can write your code in this editor
- draw_set_font(font0);
- draw_set_valign(fa_center);
- draw_set_halign(fa_center);
- draw_set_color(c_black);
- draw_text(x,y,"Interstitial");
- oInterstitial.Left Pressed Event
- /// @description Insert description here
- // You can write your code in this editor
- if GoogleMobileAds_InterstitialStatus() == "Ready"
- {
- if oCtrlAdd.interstitial_loaded != true
- {
- oCtrlAdd.interstitial_loaded = true;
- }
- }
- else
- {
- room_goto(room0);
- }
- oRewardedAdd.Draw GUI Event
- /// @description Insert description here
- // You can write your code in this editor
- draw_set_font(font0);
- draw_set_valign(fa_center);
- draw_set_halign(fa_center);
- draw_set_color(c_black);
- draw_text(x,y,"Rewarded");
- oRewardedAdd.Left Pressed Event
- /// @description Insert description here
- // You can write your code in this editor
- if GoogleMobileAds_RewardedVideoStatus() == "Ready"
- {
- GoogleMobileAds_ShowRewardedVideo();
- }
Add Comment
Please, Sign In to add comment