Squize Posted September 23, 2013 Share Posted September 23, 2013 Not sure if this is my bug or Phaser's ( I'm going with mine, but still curious ). So I create my sprites in a pool the usual way, but what I'm seeing is when I re-use one of my pooled sprites is that their x/y position doesn't seem to be getting reset on the first frame they're brought back to life. To try and expand a little, it's a simple game where I've got sprites moving down the screen. Once they hit a certain point they flag themselves up as dead and returned to the pool. When they're flagged as dead I call a houseKeeping method, ie AttackSphere.prototype.houseKeeping = function() { this.animRef.stop(); this.shadowAnimRef.stop(); this.sprite.kill(); this.shadow.kill();}; I assume the kill() method is the best way to dispose of a sprite after looking at the source. In the init() method I set up their x/y positions afresh at the top of the screen and call this.sprite.revive(); this.shadow.revive(); But I'm still getting this one frame glitch where they're plotted to their old positions. I'm going to test putting an actual one frame pause in there to see if that fixes it ( I think it will ) I was just wondering if anyone else had come across this / it's a known issue. Cheers, Squize. Link to comment Share on other sites More sharing options...
rich Posted September 23, 2013 Share Posted September 23, 2013 Nope this is a Phaser bug, but I've redone how the sprite positioning and collision is handled last night, and I've not seen this specific bug happen since. It's currently in the dev branch of Phaser but once i've finished the tilemaps it will become the 1.0.6 release (either tonight or tomorrow). RestingCoder 1 Link to comment Share on other sites More sharing options...
Squize Posted September 24, 2013 Author Share Posted September 24, 2013 Excellent, thanks for the reply mate. It's good to know I'm not going insane Squize. Link to comment Share on other sites More sharing options...
rich Posted September 24, 2013 Share Posted September 24, 2013 Due to a problem with the tile map collision and the new Body physics this isn't in 1.0.6, sorry - but it's still in the dev branch if you want to experiment. Link to comment Share on other sites More sharing options...
Recommended Posts