Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Destroy Sprites — Gideros Forum

Destroy Sprites

eclisseeclisse Member
edited June 2013 in Game & application design
Hi

Sorry for another newbie question...

I've got a list of instances of a custom class inherited from Sprite (with a TNT anomation in it) and basedupon certain conditions I want to remove them and destroy them. This may not be the best for performance but so far I've tried removing them from the stage and setting them to nil but nothing ! They keep getting events and executing them as if they still were alive...

How can I "kill" them for good ?

Thanks

Paolo

Comments

  • AhBadianeAhBadiane Member
    edited June 2013 Accepted Answer
    @ eclisse,

    If you use TNT Particles Engine, use :
    myEmitter:free() 
     myEmmiter = nil
    see UserGuide.pdf with TNT Particles Engine

    Otherwise, it must be :
    myObject:removeEventListener(Event.ENTER_FRAME, myObject.onEnterFrame, myObject)
     stage:removeChild(myObject) -- if create on stage !
     myObject = nil
    AhBadiane
  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    @eclisse would be great to see more code, but in theory yes, you need to free the animations something like this: http://www.giderosmobile.com/forum/discussion/comment/25311#Comment_25311
    And remove Sprite objects from parent
  • Aaaah, really newbie...

    I didn't think of removing the listeners and feeing up the animation.

    Thanks a lot to both !

    Cheers,
    Paolo
Sign In or Register to comment.