Jump to content

One frame pause


Squize
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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