How do I use construct 2 exports with an SPA framework

Get help using Construct 2

Post » Mon Nov 09, 2015 8:42 pm

I've been doing some research on implementing construct 2 as a gaming platform within an application, and am not finding a whole lot of information out there. Do any of you devs have experience loading a game using require.js or another SPA framework, such as AngularJS? Any pointers or information would be greatly appreciated!
B
2
Posts: 1
Reputation: 152

Post » Mon Nov 16, 2015 10:57 pm

Hi Ben,

I've been working on integrating a couple of games with an AngularJS based web app. You're right in that there isn't much info around about this, so most of what I've learnt is just from trial and error.

I start by exporting the game as an HTML 5 Normal Style game, then I pick out the bits that we need, the images, c2runtime.js, and data.js. I also tweak the c2runtime.js to correct the path to data.js as we have these in sub-folders for each game.

Within the page controller I use the angular-load plugin to load the c2runtime.js. I also copy most of the content for the c2canvasdiv from the HTML 5 webapp index.html to the AngularJS page template.

We wanted to enforce authentication prior to the user starting the game, and we also wanted to store information entered by the user into the game against their profile so if they returned they could pick up where the left off. I did this by implementing some custom actions that talk to our AngularJS services.

Sorry I haven't included any specific code examples but hopefully this gives you a few ideas on how to move forward.
B
3
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: David181 and 17 guests