Instantiating Multiple Phaser Games

Recommended Posts

I'm looking to instantiate multiple phaser game objects (three total) in a single view. I'm aware this isn't normally viable, but I was under the impression setting the type to canvas would do the trick. When it runs though, only one instance is generated. Thoughts?


InitializeSingleReel(selector, config) {
        console.log("Configuring Phaser");
        var phaser_config = {
            type: Phaser.CANVAS,
            width: 64,
            height: 512,
            physics: {
                default: 'arcade',
                arcade: {
                    gravity: { y: 200 }
            scene: {
                preload: PHASER_preload,
                create: PHASER_create,
                update: PHASER_update
            parent: selector
        var game = new Phaser.Game(phaser_config);
        game.ionic = this;

        return game;

Edit: To elaborate, this function is called three times, each time with a different selector. So it's not the script overwriting a given element (unsure what the behavior would be in that circumstance).

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.