Running behaviors in order?
bachiswach@gmail.com
Member Posts: 6
Hello everyone! I am fairly new to GameSalad and have been enjoying it so far. I keep hitting snags here and there and have normally been able to find some sort of solution by searching. Unfortunately I haven't found any information on the problem I'm currently facing, which seems strange considering the problem is something I'd imagine most people have a solution for.
Anyways, I'm trying to get behaviors to execute in an order. For example, let's say that every 5 seconds I want an actor to rotate 180 degrees, and then rotate another 185 degrees. When I execute this, my actor will only rotate 5 degrees; I suspect this is because it's running both behavior simultaneously, which only results in a different of 5 degrees. The "run to completion" boxes aren't helping, although in this instance I wouldn't expect them to. Does anyone have a solution for how to get behaviors to execute only after the previous behavior's execution is finished?
Thanks!
bachiswach
Anyways, I'm trying to get behaviors to execute in an order. For example, let's say that every 5 seconds I want an actor to rotate 180 degrees, and then rotate another 185 degrees. When I execute this, my actor will only rotate 5 degrees; I suspect this is because it's running both behavior simultaneously, which only results in a different of 5 degrees. The "run to completion" boxes aren't helping, although in this instance I wouldn't expect them to. Does anyone have a solution for how to get behaviors to execute only after the previous behavior's execution is finished?
Thanks!
bachiswach
Answers
These kinds of questions are very difficult to solve, not that the actual problem is hard to solve (it's trivial to get something to rotate 365°) but solving it so it works with the way the person asking the question has their rules and behaviours and attributes set up, it's only ever going to be a guessing game as people (for whatever reason) often won't say what their code is actually doing.
-----------
Rule:
When all of the following are happening:
if self.motion.linearvelocity.x = 0
if self.motion.linearvelocity.y = 0
// Basically, if my actor isn't moving
------------
Do:
Timer - Every 5 seconds:
Rotate to angle 15 relative to scene at a speed of 225
Rotate to angle 345 relative to scene at speed of 225
Rotate to angle 0 relative to scene at speed of 225
// No difference observed if "stops on destination" is enabled or disabled
------------
I'm just trying to get an actor to turn rotate left, right, and back to the starting point every 5 seconds to produce a little wiggle. But the reason I left it vague is because, rather than find a specific solution to this wiggle (like making an animation play every 5 seconds or something), I'd rather find a solution to the sequential behavior execution problem I'm facing since this has plagued me in numerous forms so far.
I appreciate any help I can get!
I see, I think the sequential behavior execution issue will differ from project to project, it's dependent on a number of factors.
Hold on, let me make you a quick wiggle demo.
Link: https://www.mediafire.com/?crb504c4kdr9m1x
Hold on, I think there's a better version that could be done . . . back in a second . . .
Link: https://www.mediafire.com/?z5yrc2ro1wlwnqd