Saturday, 31 May 2014

How to add pubcenter ads in Construct 2 game

If you have made a window 8 game on construct 2 and you want to earn from your game. Here is a way you can add pub center ads in your game. First of all you must have a window 8 or 8.1 in your system and a copy of visual studio 2012 or later that should be installed in your system. In your visual studio you must have Microsoft advertising SDK installed. Now to add ads in construct 2 game you will have to download a window 8 plugin from HERE. Drag that downloaded file into the construct 2 window. It will show that following window

Install the required plugin, and restart construct 2. After that open the create new object window as shown in the image below

You will see a "Window 8 advertising" object will be appear in this window. Insert a new object of it and you can see that the default size is 250 x 250 but you can change it following the available ads sizes in pub center. Details related to it are given in the following LINK. You can change different properties of this ad as shown in the below image

After doing all these settings, export your game to visual studio (see, how to export from HERE). Right Click the solution and Add reference and check the Microsoft advertising SDK and click OK.

After that you will need the add the following line of code just below the base.js and ui.js file in index.html file
<script src="///MSAdvertisingJS/ads/ad.js"></script>

At the end, enable the internet capabilities in the package.appxmanifest file. You are done :)