InsaneHero

flicker if created then moved

Recommended Posts

If I do this:

 

h = game.add.sprite(0,0, "hospital");
h.x = 49900 - h.width;
h.y = findGround(h.x + h.width) - h.height + hospitalOffset * 0.5;
 
The sprite will display at 0,0 (top-left of the screen... ignoring the camera location) as a brief flicker before moving to the correct location.
I'm guessing this is down to some precalculated transforms which aren't updated by the x,y setters.
What function should I call to recalculate the transform to prevent this flicker?
 
(Notice that I can't position it directly because I need the width and height of the sprite which aren't available until after it's been created)
 

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.