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

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).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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