Jump to content

About the stage


Tufan
 Share

Recommended Posts

I get this error when restarting Game state.

Quote

Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
    at new c.BitmapData (http://localhost/phaser.min.js:3:388849)

This line causing the error:

this.player.healthbar = new HealthBar(this, {x:this.player.x, y:this.player.y-25, height:5, width:50});

It's all fine if i call world.removeAll in the state.shutdown function.

shutdown: function(){
	this.world.removeAll();
}

Why am i have to call world.removeAll after switching states? Shouldn't it clear the game world itself when game.state.start is called?

Docs says "but not the Stage, so if you've added your own objects to the Stage they will need managing directly"

Is healthbar added to the Stage? If so, What is the stage?

I'm using phaser.healthbar plugin to create health bars.

 

Link to comment
Share on other sites

21 hours ago, samme said:

How are you calling game.state.start (or restart)?

Game.js:

setTimeout(function(){
	this.state.start('MainMenu');
}.bind(this), 1500);

MainMenu.js (triggered on click):

this.state.start('Game');

Edit: Physics is also started on Game state if i start physics on MainMenu. Is this normal?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...