back and forth variable

jeffcollinsjeffcollins Member Posts: 13
edited November -1 in Working with GS (Mac)
Hi

I am trying to make an actor move in a random way, similar to the pace back and forward that has been mentioned on this forum before but I want the actor to randomly go left or right either a bit or all the way. Can anyone help me with any advice for this particular variable?

many thanks

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Timers + Change Attribute are your friend.

    Create an actor attribute that is of integer type. Call it LeftRight

    Create a Rule to check if that attribute is equal to 0, then do your movement to the left.
    Create a Rule to check if that attribute is equal to 1, then do your movement to the right.

    Add a Timer behavior to the actor that every # seconds Change Attribute of the LeftRight integer attribute to the expression random(0,1)
  • jeffcollinsjeffcollins Member Posts: 13
    Thanks Code Monkey,

    It sounds like an ideal solution, Ive had a few problems implementing them though :-) but it gives me a head start,

    cheers
  • jeffcollinsjeffcollins Member Posts: 13
    Actually... its not just ideal... its a brilliant solution :-) i just had a problem when my move was sending my actor right and it was hitting a collider to send it back left... the actor didn't know whether to stick or twist,
Sign In or Register to comment.