Hello I have an object with 2 animations that are the same but a different colour. Animation “idle” has 3 frames and so does animation “hit” how do I sync both animations when changing from one animation to the other without resetting the loop each time?
This is what I want to do
When “cross” is in collision with “eye” and “idle” animation is frame 1 then change the animation to “hit” frame 2 for 0.1 sec then back to “idle” frame 3 and if “idle” is frame 2 change animation to “hit” frame 3 then back to “idle” frame 1 and so on for each frame.
Before you set the animation, get the current idle animation frame and store it in a variable. After you set the hit animation, change the animation frame to the one what you stored in the variable.
Similarly for changing from hit to idle animations.
you can add sub event below
even : the animation of eye is “idle”
sub even : the animation frame of eye = 0 (first frame of the animation)
and the action is:
action :
set animation of eye to “hit”
change the animation frame of eye set to 1 (second frame of the animation)
pause the animation of eye
It’s in the actions. You can’t assign values to variables in the conditions. Use eye.sprite() to get the frame number (yeah, I know, it’s not very obvious).