Is there a way to check whether an animation has ended?
I'm back, and I've moved on fairly quickly. It's an animation question now! I've been scouring the scene module documentation, and every example/tutorial I can find, but I can't figure this one out:
I want to perform an action on a node, call a method to do some stuff, then perform another action, in that order. But since actions don't wait until other actions are finished before beginning, all three things are happening at the same time.
Again, I've been scouring the documentation and I tried creating my own little solution as well but I can't seem to work something out!
EDIT: I'd like to point out that I got the hang of the basics of action sequences, that's not the issue. It's the fact that in between the two actions, I want to call a non-action method.
Action.wait(seconds)is what you're looking for. Put it in an
Action.sequencebetween two other actions, and there will be a pause between the two animations.
Thanks, but I don't need a pause between them. I need to call a non-action method! That's what I can't figure out.
I tried putting in a check of the status (in this case to see if the rotation animation has reached its goal) but that won't work unless it's in the draw method of the scene since It will only be checked once. Using scene.draw() as a catch-all place to do checks like that seems... not ideal.
A.sequence(some_animation, A.call(self.do_something), other_animation)
A = Action, as in most examples)
Hmm. I did try that and had gotten an error, but if you think it should work I'll try it a bit more :). Thanks!
I can't get A.call() working :/ I get the error "Object is not callable". The offending line is:
Where A = scene.Action.
@WTFruit It should be
A.call(self.method)(note the missing parentheses after
self.method). You need to pass the actual function/method object that should be called, not the result of calling the method.
Huh okay! Very small detail that I would have missed but makes sense now. Thanks :)