Monetizing an HTML5 game with FGL HTML5 API – even if you are using Construct2

About a week ago I blogged about the experiment to monetize a game in the post MochiMedia era, and my experiment continues trying to get my HTML5 game Whack a Creep using one of the oldest services for game monetization: FGL which is also my favourite service.

You should already about FGL opportunity for HTML5 games, I also blogged about it in the post FGL will pay IN ADVANCE up to $200 for your HTML5 games.

You only have to download the API from the official page and use them in your game. There is a really simple yet complete documentation about the whole process, as well as a real world example with a Fruit Ninja game.

Unfortunately, if you made your game with Construct2 (like I did), there isn’t a plugin to easily add the API in the game, so I had to edit something here and there.

I am going to show you what I did in order to have ads, cross promotion and leaderboards in my Constrcut2 game.

First, you have to make some small changes to the index.html file generated when you publish your game: you can find them highlighted

Look how I changed the default file generated by Construct2:

Line 78: calling the javascript library you can find in the zipped file available in the official page

Line 87: API initialization

Lines 98-100: I am running the game only once the API is ready

This is all you need to code at the moment.

Now, a brief look at the Construct2 splash screen sheet:

Don’t mind about the two “On start of layout” events: I am just keeping them separated during debug process to easily activate/deactivate some actions.

This allows me to easily add both ads and cross promotion in the splash screen

Obviously this won’t automatically allow me to make money out of this game… now I have to submit it for approval, then sit, wait and hope – while making next game.

Stay tuned.