Running behaviors in order?

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

Answers

  • Just a note, I've also tried changing a game attributes once the first rotation is complete to trigger the second, but I face the same problem: it's executing the attribute change at the same time as the rotation.
  • SocksSocks London, UK.Member Posts: 12,822
    . . . . 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 . . .
    Caution: rant approaching, take cover.

    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.
  • Thanks for the response, here's what I'm trying to do:

    -----------
    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! :)
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2014
    @bachiswach@gmail.com
    Thanks for the response, here's what I'm trying to do:
    Cheers for the rules ! It makes problems much easier to solve !

    -----------
    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
    ------------

    Self.motion.linearvelocity has no effect on rotation, for example if an actor is spinning around like crazy its self.motion.linearvelocity will read '0'.
    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.
  • SocksSocks London, UK.Member Posts: 12,822
    5 second cycled 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 . . .
  • Just a note, the linear velocity set to 0 requirement isn't supposed to be directly tied to the rotation. It's meant to mean: "If my actor isn't moving up/down or left/right and is idling in one spot, then every 5 seconds wiggle"
  • Oh awesome, thank you! I'll try this out now :)
  • Just from digging through this first demo I can see how constrain and interpolate are powerful tools...I really appreciate the help!
  • SocksSocks London, UK.Member Posts: 12,822
    Here's a more simple wobble, might be some us to you . . .

    Link: https://www.mediafire.com/?z5yrc2ro1wlwnqd
  • Both of these are great! I think the first one is geared closer to what I'm trying to accomplish, but they're both useful tools. Thanks for the help, Socks! You rock :-D
Sign In or Register to comment.