Noaml1 Posted May 24, 2014 Share Posted May 24, 2014 So i'm at a hackathon (btw quick responses appreciated because of this fact (´・ω・`) )and my friend and i are dealing with a players die and respawn often. we know that when we want to add a sprite to the game from within a class that extends Phaser.Sprite we have to run the code: super(this.game, x, y, ResKeys.player2Sprit); this.game.add.existing(this); //<-----this is the line im referring toso we want to know if theres an opposite to this.game.add.existing where we can remove the sprite from game existence without killing the class, put it back into that state of limbo between the super() and add() calls. Link to comment Share on other sites More sharing options...
j0hnskot Posted May 24, 2014 Share Posted May 24, 2014 If you assign the created object (in that case "the class that extends the Phaser.sprite") to a var and then add the var to the game you can then easily kill it by calling .kill() since the var will be a sprite.Then you can use .revive() if you want it to keep the same position it where when it died. Link to comment Share on other sites More sharing options...
Recommended Posts