Disclaimer: This guide was originally written by Andy Reitberger. It has been published here with his consent. If yo want to access the original article you can do it clicking here.
Prepare the game
Basically you don’t need to make adjustments to your project if you already used Cordova plugins (for example from cranberrygame). You can directly export it the way it is.
If you want to compile for Canvas+ (what I recommend) you must replace all “Browser” functions like “Close Browser” with the events and actions provided by the new Atomic Plugin ‘CocoonCanvasplus’.
Open your project in Construct 2 and choose “Cordova” as exporter.
Uncheck ‘Minify Script’.
You can leave the default settings. Just confirm and export it.
Important! There is a bug in the c2runtime.js file. Please check this guide to see how to fix it.
Then open the the export folder and open the ‘config.xml’ file with an editor of your choice and search for:
<gap:plugin ... />
Copy all your plugins into an additional text file. We’ll need the code in the next step.
Now delete following files.
- config.xml (make sure you’ve copied the plugins)
Eventually zip all remaining files. This zip file is for uploading in the next step.
Create a new project
Login in the Cocoon cloud in and create a new project by uploading the zip file from the previous step. Just Drag’n’Drop the ZIP file in the area ‘Drop ZIP or Upload’.
Your project will then be created. After that, open the project and visit the “Settings” tab and enter your details.
Important: Don’t forget to save the settings by clicking the small icon in the right bottom corner.
Now go to the ‘config.xml’ tab and search for the last closing platform tag.
Under this closing tag you need to insert the copied plugin tags from the old config.xml file, remember? Additionally you can add the plugins at the ‘Plugin’ tab, but this way works faster. My old plugin tags are looking like this, but you must adjust the links the way shown below.
In the example before:
<gap:plugin name="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#1364a0cc0a782793070396fde481ee5bb6ec5ab7" />
<gap:plugin name="https://github.com/cranberrygame/com.cranberrygame.cordova.plugin.reviewapp#9ec167e557a1c57e1ceb6bbbd2a64c536c4b64d3" />
<gap:plugin name="https://github.com/cranberrygame/cordova-plugin-game --variable APP_ID='YOUR_GOOGLE_PLAY_GAME_APP_ID'" />
<gap:plugin name="https://github.com/cranberrygame/cordova-plugin-payment-iap" />
<gap:plugin name="https://github.com/danwilson/google-analytics-plugin#c13ad4bb9d165b0036f2a6f7f10aeeda48f9f72b" />
<gap:plugin name="https://github.com/simplec-dev/powermanagement#c827126f30514a17644c3a3d15230b3396d07022" />
<gap:plugin name="org.apache.cordova.dialogs" version="0.2.10" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.vibration" version="0.3.11" />
Save the changes. If you check the ‘Plugins’ tab now, then you can find the added plugins also there.