how to synchronize my actions with each other? #1615
-
My update() method doesn't work well. I time it at 6.5 seconds (the duration of my action), each time after this time the update() function sets the action to all objects in the pool. Thus, new actions begin at the same time as old ones begin and everything works synchronously. But with each subsequent update() i can see that new objects are slightly behind the animation of the previous ones code:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
When you refer to "actions", do you mean you referring to |
Beta Was this translation helpful? Give feedback.
-
There is no clean way to synchronize the actions that I know of. I actually faced this exact issue (also with fading in and out), and even made an attempt to add that kind of functionality to the Action sub-classes, but didn't get anywhere with it because of time constraints. My work-around was to manually synchronize all the actions any time that same action is added to a new node, meaning setting the same opacity and calling
Regarding your specific issue though, it may be to do with the fact that it is never precisely 6.5 seconds each time you enter that section:
If You need to re-think your logic. |
Beta Was this translation helpful? Give feedback.
The current actions only work on one node, but you need to write a custom action that does not operate on the node it's attached to. That way, you can just add it to the scene, but it won't affect the scene. It also doesn't even have to be an action, but custom node or some other object, as long as they have an
update
method. It's basically just managing a list of nodes that it operates on to change their opacity.You maintain a list (
ax::Vector
) of nodes within that custom object, and simply have methods like this:To process the nodes, you would do what the curre…