Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Removing sprite after a delay question (something like bind in js?) — Gideros Forum

Removing sprite after a delay question (something like bind in js?)

NinjadoodleNinjadoodle Member
edited October 2017 in General questions
Hi guys

I'm trying to remove a sprite using a tweens onComplete function. I'm not sure how to make the function retain the correct reference to that sprite, so it doesn't throw an error when there are a few sprites on the screen.

In javascript, I think you would use bind()?

Any help would be awesome :)

Thank you!

Comments

  • piepie Member
    Accepted Answer
    Theoretically I think that as long as the sprite belongs to the same scope of the tween it should retain the correct reference .
    Another option could be to use a single global table where every entry is a reference to a sprite you may need to remove. It's not cool to use global vars, but in this scenario you would get rid of it as soon as you no longer need it.
  • Hi @pie

    I think you're right, it seems to retain a reference to it :) I was worried it wouldn't work but after testing, everything is fine :)

    Thanks for the help!
Sign In or Register to comment.