Jump to content

State reset problem (Phaser Coding Tips 7)


nkholski
 Share

Recommended Posts

I based my game's bullet system on "Phaser Coding Tips 7",  the create a Shoot-em-up tutorial (http://phaser.io/tutorials/coding-tips-007). Everything works fine until I reset the state, and I can't figure out any solution (this.getFirstExists(false) fails to find any bullets).

 

The tutorial source code is available on: http://jsbin.com/ferapejeja/edit?js,output

 

I added this in the Create-function at JS Bin to simulate the exact same problem I face in my game:

 

var reset = this.input.keyboard.addKey(Phaser.Keyboard.R);reset.onDown.add(function(){this.game.state.start('Game');}, this);
If I hit "R" during game play the state resets as expected, and everything seems to work OK except the bullets wont work.
 
Any ideas on how this could be solved?
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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