How do I use construct 2 exports with an SPA framework

0 favourites
  • 2 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)