Jump to content

Changing scenes


Recommended Posts

I am sure this is a completely dim question, but I can't find what I'm looking for.

I'm using Angular4 with phaser:

    this.phaserGameConfig = {
      type: Phaser.WEBGL,
      width: width,
      height: height,
      parent: 'game-play',
      scene: null

    this.phaserGame = new Phaser.Game(this.phaserGameConfig);

    this.phaserGame.scene.add('GAME_0_Loading', new GAME_0_Loading(this.phaserGameConfig, this), false);
    this.phaserGame.scene.add('GAME_1_Welcome', new GAME_1_Welcome(this.phaserGameConfig, this), false);

I have around 10 scenes and I need to change between them so that each time the scene loads it starts afresh each time.  i.e. any old scenes are completely destroyed and when I load the scene all the elements load from scratch as if the scene has never loaded before.

I was thinking that the way to do this would be:


However, when I do this I am seeing what appears to be legacy stuff from previous instances of the scenes.  I am finding that I am having to do:


To prevent very odd overlays of buttons etc on scene changes.

Further, tweens that I have used to bring elements into the screen are taking more time before they run each time one particular scene loads.  As if the time delay for the tween is being added to on each load of the scene.

Any guidance would be appreciated.  If you need any more code samples then let me know :)



Link to comment
Share on other sites


  • Recently Browsing   0 members

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