Procedural execution of actions of actors?
TheGabfather
Member Posts: 633
Hi guys,
I'm wondering if it's possible to execute several actions in a procedural manner? (One after the other)
Right now I have an actor that when clicked, does 3 things:
Interpolate to a new width
Interpolate to a new height
Spawn another actor
When I place all those actions inside my rule, all three fire at the same time. I was hoping for the third step (spawning) to happen only once the first two interpolates finish.
Right now I'm going about this by doing a self.time check - the first 2 steps take 1 second to finish, so I start spawning at self.time = 1. Now I took out the Rule when touch is pressed for testing's sake, but I was thinking once I touch on the actor I simply reset self.time first so it returns to 0.
This works fine but I was wondering if there's a better/simpler way to make it act in a procedural way?
Thanks guys!
p.s. I'm using Windows Creator now at my university dorm. But I also have access to a Mac Creator back home, just in case it's a Windows-specific dilemma.
I'm wondering if it's possible to execute several actions in a procedural manner? (One after the other)
Right now I have an actor that when clicked, does 3 things:
Interpolate to a new width
Interpolate to a new height
Spawn another actor
When I place all those actions inside my rule, all three fire at the same time. I was hoping for the third step (spawning) to happen only once the first two interpolates finish.
Right now I'm going about this by doing a self.time check - the first 2 steps take 1 second to finish, so I start spawning at self.time = 1. Now I took out the Rule when touch is pressed for testing's sake, but I was thinking once I touch on the actor I simply reset self.time first so it returns to 0.
This works fine but I was wondering if there's a better/simpler way to make it act in a procedural way?
Thanks guys!
p.s. I'm using Windows Creator now at my university dorm. But I also have access to a Mac Creator back home, just in case it's a Windows-specific dilemma.
Best Answer
-
The_Gamesalad_Guru Posts: 9,922Add rules inside your rule. This is what a rule is an execution order after a variable meets a condition.
RULE on lets say variable condition; when touch is released. (Must use release as pressed is a temporary condition)
interpolate to width 45
RULEinside main rule; when self width = 45
interpolate height to 56
RULE inside main rule; when self.width = 45 and when self.height = 56
spawn actor.
to delay even more encapsultae eash behavior in a timer to add delay.
Remeber this is logic so when designing how events happen think in logic.
Answers
I never thought of doing that before, but I understand it completely.
Thanks for your help!