I want to make a custom behavior that when the objects was created, it will fade in, then change animation, then fade out at a certain point (using timer obviously)
I want this for my spike object that has 2 animation. Animation 1 is the spike is a hole only and Animation 2 is when the spike will rise.
I want it that when it’s created, it will be in 0 opacity up to 255 (fade in) then a few seconds it will change to animation 2 so that the spike will rise. Then fades out after the animation 2 is done playing.
I want to use custom behavior to this so that it doesn’t affect other spike when multiple spikes created. But if anyone can do it using for each object then it’s fine too.
Hope anyone help me with this!
Look at using a finite state machine. Store the state the object is at in an object variable. Then create a set of conditions that deal with each state.
Something like :
(note, the last tween has the “Destroy this object when tween finishes” set to true)
These events could probably also be used in a behaviour.
you need “on creation” but is missing in GD.
A workaround should be:
“On creation” does exist, to an extent. Whenever you use the create object action, all actions immediately following the create action (in the same event) target that created instance.
In most cases that method of targeting the instance should be enough, or at worse you can just set an instance variable of “JustCreated” to 1 as part of the create event, then have a deparate event that takes actuont on any instances with that variable set to 1, then set it to 0 as fhe last action.
This actually works perfectly fine! Thanks for helping me out @MrMen as well as @jumpingj and @Silver-Streak.