Integrate AdMob ads and InApp into your Construct 2 game project using our template!
Please make sure that you always uses the latest version of the asset. You will find the download link below.
[creativ_button url=”https://goo.gl/CXUZ4T” icon=”download-alt” label=”Download Game Template 3 – AdMob Ads and InApp” colour=”green” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
[creativ_toggle icon=”heart” heading=”Already purchased?” onload=”closed”]
Thank you for your purchase! It’s highly appreciated. You can download the latest version of my asset at your downloads.
[creativ_button url=”https://goo.gl/3AFr1I” icon=”heart” label=”Download latest version” colour=”green” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
If you like our item, please consider to leave a five star rating on scirra. This would mean a lot for me! Thank you.
[creativ_button url=”https://goo.gl/O3VtP1″ icon=”heart” label=”Rate your downloads!” colour=”red” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
The game template is optimized for cocoon.io. It also adds following features to your game.
- Show AdMob banner & interstitial ads in your game
- Allow your player to purchase a “Ads Removal” via InApp Purchase (Google Play & iTunes).
- Works for Android and iOS!
- Built in 1280×800 px (Landscape)
- Capx file included
This game template needs the “Cordova Plugin Package” by cranberrygame. Get it below.
The plugin package above is mandatory to open and use the game template!
Need help? Don’t hesitate to write me in my support forum.
[creativ_button url=”https://shatter-box.com/forums/” icon=”cog” label=”Get support” colour=”blue” colour_custom=”” size=”medium” edge=”rounded” target=”_blank”]
The following guide will show you how to integrate the template in your existing project.
Install the plugins
You’ll find all needed free plugins included in the download package at “02_Plugins”. Please install those plugins first before you open the Construct 2 project file (.capx). Below you find a list of all needed plugins (free & premium).
- SpriteFont+ (Download)
Get those plugins here for free.
If you need a guide showing you how to install a plugin at Construct 2, please see here.
- Cordova Dialog (Core)
Get this plugin here.
Prepare your Project
Once all plugins are installed, you can open your project and the template capx file. Firstly we need to prepare the your project and add all needed plugins & event sheets to it.
Please add following objects to your project (if not already included).
Afterwards add following event sheets to your project. You also could copy all code in one global event sheet. This is only my way to keep the project clear.
- es_language (actually not needed, just if you want to integrate the Language Game Template as well)
Now include the
into the “es_global” event sheet. Then include the “es_global” event sheet to your main eventsheet of your project, so that the functions are available throughout your game. In order to do that, just perform a right mouse click in the “es_global” event sheet and choose “Include/Exclude event sheet”.
At my template the “es_store” event sheet is the main event sheet which is associated with the “store” layout. So I included the “es_global” event sheet there.
Now we can start to copy the content from the template to your game project.
Start with the variables. Copy them to their corresponding event sheet in your project.
Then go to the store layout at my template and copy all objects.
Now, if you have copied all objects, all variables & added all plugins, you can start copy the code from our template’s event sheets to the corresponding event sheets at your project.
Add your ID’s
Don’t forget to add your ID’s to the “CocoonAds” plugin. You will find test ID’s from AdMob. Use those ID’s during development and tests.
Show / Hide Banner Ads
You need to specify in the “es_ads” event sheet on which layout the ads should be shown & on which they should be hidden.
Just add the layout names either to the show or hide conditions. Then a banner ad will automatically shown on those layouts, if the ShowAds var is equal 1 (if no ad removal is purchased).
Show Interstitial Ads
In order to show an interstitial ad you just need to call following funtion.
This function will show directly an interstitial ad.
If you want to show an ad every fifth time, then call following function instead.
This function will count down from 5 to 0. If the counter hits 0, an interstitial ad will be shown and the counter will be set back to 5. You can call this function on each game over (if the player dies for instance). Then the function will show an ad every fifth game over.
It also saves the current count value to the localstorage.