Game Development Reference
In-Depth Information
Right-click on this listing and then select the Export Extension option from the drop-
down list. This will bring up Windows Explorer, which allows us to select where to save
the extensions. Save the extension somewhere it will be remembered as we need to import
this extension into our own project.
Once this is done, we are ready to go. Open either a project of your own or the one created
during Chapter 7 , Making a Game .
We now need to import the extension into our own project. To do this, right-click on the
extensions listing in the resource tree and select Import Extension . Then, browse to the
location where the exported extension is saved and load it into this project.
The extension should now show inside our resource tree. Open the extension in the re-
source tree to reveal the functions available to us.
The first thing we need to do is initialize the extension. This should be done before any
other ad function is used. In the project created in Chapter 7 , Making a Game , this should
be done in the player object's create event. Add the GoogleMobileAds_Init function
to a new line in the create event.
We now need the ad ID code that we saw on the AdMob web page. Copy the code and
paste it in between quotation marks as the argument for the GoogleMobileAds_Init
function:
ca-app-pub-2902099209220920/9999091909
We can now display ads in our game. All we need to do is load an ad and then display it.
Ad loading times vary depending on the Internet connection of the player.
Search WWH ::




Custom Search