1. Home
  2. Documentations
  3. Templates
  4. Game Template 3 – AdMob Ads and InApp
  1. Home
  2. Advertisement
  3. AdMob
  4. Game Template 3 – AdMob Ads and InApp

Game Template 3 – AdMob Ads and InApp

About

Integrate AdMob ads and InApp into your Construct 2 game project using our template!

Download

Please make sure that you always uses the latest version of the asset. You will find the download link below.

  Download Game Template 3 - AdMob Ads and InApp

Already purchased?

Thank you for your purchase! It’s highly appreciated. You can download the latest version of my asset at your downloads.

  Download latest version

 

 

If you like our item, please consider to leave a five star rating on scirra. This would mean a lot for me! Thank you.

  Rate your downloads!

 

Features

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

Requirements

This game template needs the “Cordova Plugin Package” by cranberrygame. Get it below.

Icon

Cranberrygame - Cordova Plugins 150 MB 2769 downloads

Download the awesome Cordova Plugin Package provided by Cranberrygame. The package...

The plugin package above is mandatory to open and use the game template!

Support

Need help? Don’t hesitate to write me in my support forum.

  Get support

Integrate

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).

Default

  • Function
  • Touch
  • LocalStorage
  • Browser

Other

Cocoon (free)

  • CocoonAds
  • CocoonInApp
  • CocoonCanvasPlus

Get those plugins here for free.

Icon

Cocoon Construct 2 Plugins 8 MB 3670 downloads

Download the Cocoon Plugins for Construct 2 now! The download link fetches the latest...

If you need a guide showing you how to install a plugin at Construct 2, please see here.

Cordova

  • Cordova Dialog (Core)

Get this plugin here.

Icon

Cranberrygame - Cordova Plugins 150 MB 2769 downloads

Download the awesome Cordova Plugin Package provided by Cranberrygame. The package...

 

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.

Objects

Please add following objects to your project (if not already included).

  • Touch
  • LocalStorage
  • Browser
  • Function
  • CocoonAds
  • CocoonInApp
  • CocoonCanvasPlus
  • CordovaDialog

Event Sheets

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_ads
  • es_global
  • es_localstorage
  • es_language (actually not needed, just if you want to integrate the Language Game Template as well)
  • es_inapp

Now include the

  • es_localstorage
  • es_ads
  • es_inapp
  • es_language

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.

Tipp!

It’s a good way to store functions in a global event sheet. So you can access those functions from every other event sheet from your game.

Copy Content

Now we can start to copy the content from the template to your game project.

Variables

Start with the variables. Copy them to their corresponding event sheet in your project.

Objects

Then go to the store layout at my template and copy all objects.

Important!

Don’t forget the little particles object at the “FX” layer 😉

Code

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.

Usage

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.

[code]Ads.ShowInterstitial()[/code]

This function will show directly an interstitial ad.

If you want to show an ad every fifth time, then call following function instead.

[code]Ads.count[/code]

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.

Updated on May 3, 2018

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.