Sign in to follow this  
BdR

Run a game.state example in in the sandbox, not possible?

Recommended Posts

I'm trying to run one of the Phaser examples in a sandbox to reproduce an audio question by running an altered version of this audio example in the sandbox.

I've altered the code (see link to sandbox below) but when I click the Play tab, the console shows this error message.

Quote

Uncaught DOMException: Failed to execute 'postMessage' on 'Window': TypeError: Cannot set property 'prototype' of undefined could not be cloned.

So it seems the sandbox cannot run Phaser games that make use of the StateManager.
Should the sandbox be used in another way for the game.State to work?
Am I doing something wrong here?

See saved sandbox -> https://phaser.io/sandbox/edit/ZBBLlXiA

 

Share this post


Link to post
Share on other sites

Hi @BdR,

That DOMException is resolved with this (mygame.MyGameState was undefined):

mygame.MyGameState = function(game){};

mygame.MyGameState.prototype = {
    preload: function() {

............... more code ...............

Phase Sandbox can use the StateManager. Here a simple example: http://phaser.io/sandbox/UUWjHaIA

Each state must contain at least a one of the required functions: preload, create, update or render (check your "mygame.MyState ")

To change the game size use the size selector in the "Play" tab. Declaring a new Phaser.game adds other canvas, and seems game.destroy() can't be used.

Regards.

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.