Animation on object removal

edited November 2011 in Help request
Hey, I have a question. Is there support for something like, after an object reaches its lifetime, playing an animation before it's deleted? For example, if we were dealing with bullets, after they hit their lifetime, could I have them lose their physics properties and fade out or something like that? Or if the spawner that controls the bullets is deleted, and all the bullets will be deleted with it, would I be able to animate them before they disappeared?


  • edited November 2011

    Lifetime really means deletion. If you want to stage something like this, you can either store a time stamp at creation and compare it in your update function or, simpler, start a timer (they can be found in the orxClock module).
    Then when your timer expires you can remove the physics and fade them out. Another option would be to really use LifeTime and listen for the object's death and then create a temporary object that's only visual, will fade and delete itself when done.

    Same story for the spawner, you can go through all objects owned by the spawner, do whatever you want with them (like fading them out + LifeTime) and then delete your spawner. In this case make sure you setup your spawner to not delete the spawned object when it gets deleted (it's a config property).

    Hope this helps!
  • edited November 2011
    Ah, OK. I just wanted to make sure that you didn't have something that got called on object death that we could modify. That could actually be a pretty cool function to add, but it might not be worth the time or effort at the moment.
Sign In or Register to comment.