starting an animation at a random position

edited June 2011 in Help request
I was just wondering, if there is a easy way to start and animation at a random frame rather then always on the first frame?

I have a rather long animation that will be applied to several objects on the screen. it looks a bit stupid when they are all in sync.

so if there is a easy way to achieve that, that would be great.
otherwise I will split up this one animation into multiple animations and somehow randomize between those.



  • edited June 2011
    Mmh, there's no way to specify a frame but you can set a time instead with orxAnimPointer_SetTime().
    If it's only to avoid some sync issues, that should work. If you need more precise control, I'll have to think about it as we don't expose the anim frames themselve for now. I can add that in the new anim system on which I'm currently working though, let me know. =)
  • edited June 2011
    great. that's all I need!!
    thank you :D
  • edited June 2011
    is there a way of determening the total length of a animation programmatically?

    I was just starting the animation at a random value that also could be greater then the length of the animation.
    orx resolves this nicely. however there will be some hiccups directly after starting the game.

    I just set the maximum random value to something rather small, then everything works fine. Though, it would be nicer not to have some magic number in the code ;)
  • edited June 2011
    Yep, you can access all the properties of an orxANIM, using the orxAnim.h API.

    The annoying step is to actually get the anim you want. You have to query the orxANIMSET for that.

    Usually you have an orxANIMPOINTER on your orxOBJECT, you can then retrieve the orxANIMSET from it.
    From the orxANIMSET, you can get the orxANIM using its handle, given by the orxANIMPOINTER with GetCurrent/TargetAnimHandle.

    It's a bit convoluted. I'll try to add more accessors in the new anim system. :)
Sign In or Register to comment.