A quick note on Interstitial Ads in Game Maker using Admob. Interstitial ads are handled mainly the same as regular banners, only with a couple of minor slight modifications. Go ahead and create the new Intersitial ad on AdMob’s website and copy your Ad Unit ID code. As before, paste this code into any one of the 4 keys for Admob under the advertising tab in the Global Games Settings window.
Now, with banners, we’d have to enable them and move them to an appropriate location. Not so with interstitial ads. First of all, they’re not enabled by the usual ads_enable(x,y,key) command. And second, being that they’re interstitial and fullscreen, we have no control over the position of the ad onscreen. So then, how do we enable an interstitial ad? Simple. With just one line of code:
I’m not entirely certain the specifics behind calling that function, as you don’t pass it any arguments. Say you were to have multiple interstitial ads entered in individual keys in GM – AdMob would treat them separately as far as impressions and clicks go, correct? So when Game Maker displays an interstitial ad, which one does it choose? This isn’t a major concern for me, because I don’t see myself using separate interstitial ads in one app.
You’ll notice though, calling that function might not always work. In fact, one time you might try it and it’ll work perfectly, and the next time, in a different room, you’ll notice that absolutely nothing happens. Why is this? After quite a bit of frustration, I realized: calling the ads_interstitial_display() function isn’t like enabling a banner ad. When you call the function, it doesn’t just enable the ad and it’ll finally display it when it’s loaded and good to go. No. When you use the ads_interstitial_display() command, it attempts to launch the interstitial ad that very step if it’s available. And if it’s not available? You’ll have to call the function again when it is. Enabling ads is more of a boolean, and interstitial ads are more of a one-time function. Fortunately, Game Maker has a function built in that allows us to check if the interstitial ad is loaded and good to go:
So very easily, in the step event, we could do something as follows:
displayed_interstitial_ad = 1;
The “displayed_interstitial_ad” is just a variable/boolean I created that we set to 1 after we display the ad so it won’t constantly display it over and over again when the user clicks out. I found that it takes about 3 seconds to load the ad after you launch your app. I was attempting to display the interstitial ad within a second or two after my app launched, and of course, it didn’t work. So… give it some time to looaaaad, man.
With that being said, I can now implement banners and interstitial ads in my app!