Hello guys.
I've been using the custom animation events with no problems.
But now it looks like the moment which those events are triggered has changed.
They used to be triggered at the end of each animation frame and now they are triggered at the begining of each animation frame.
iarwain, have you changed something related to the animation events?
Comments
Yes, that was changed almost 3 months ago and it was a bug: https://forum.orx-project.org/discussion/4732&limit=20&start=40#5267
That was only happening with events declared in config (if you were using the code API, the events would have been registered at the beginning of the frame).
Sorry for the inconvenience!
Is it possible to add some kind of indicator that tells the animation system whether an event should be registered either at the begining or at the end of a frame?
I think that would be good not only to me.
Thanks.
However you should be able to write a pretty simple piece of code that would change all the events for you and save them back to config.
Another simple option would be to cycle through all the anim after they're loaded, go through all the events with orxAnim_GetNextEvent(), and re-add them with the new timestamps with orxAnim_AddEvent().
Or a regexp executed on your config files should do the trick.
Lastly, you can always simply backout the change that contains the fix from orx's source in your local hg repository clone for your current project. It's this one: https://bitbucket.org/orx/orx/commits/d4603f59b0d277aca872e96eac105abbbf714305
So, I will do the get/add event method. Can you help me with this one?
I think I have to get the event and add the frame duration to its timestamp, right?
When I re-add the event, will it overwrite the current event?
For the get/add, you need to go through all events, store them locally with the new timestamps, remove them all and then finally re-add them all.
The way orx were before the fix, the events were triggered at the end of the animation frames. So, in the event handler, I put some game specific code for each event triggered.
Now that orx triggers the events at the beginning of the animation frames, my game specific code is called before it should be. So, I have to change it in order to work properly.
Having said that, I don't know which events you are talking about when you say "the new events are at the exact same time as with the old code".
The new event added with KeyEventName5 will have the exact same time stamp as an event named KeyEventName4 with the old version of orx, isn't it?
For events that were on the last frames, you can either use the stop/loop event, or better add a new key at the end of the anim with a duration of 0, that should do the trick!
Thank you.