Move behavior with an angle attribute

cibramcibram Member Posts: 7
edited June 2012 in Working with GS (Mac)
Hey guys,

I have an angle attribute, which has a formula and calculating an angle changing every second.

In the Actor's Move behavior i want him to move towards that angle, but because the attribute always changing my actor is changing the direction as well.

How can i fix that? Basically i want my actor move to the direction he takes from the attribute at the beginning, even the attribute will change my actor should not change the direction.

An example for what i want to do :

- My actor spawns
- Formula says him to move to the direction angle : 290
- He move to angle 290 and goes out of the screen

(He should not change this direction 290 to 250 or something else even the attribute change at the middle of the screen)






Best Answer

  • jn2002dkjn2002dk Posts: 102
    Accepted Answer
    Make a local attribute in the actor you want to control, you could call it localAngle, and when the actor spawns set this.localAngle = the angle from your formula

    Then you use localAngle to control the direction of your actor

    Not at my GS computer right now so can't make an example

Answers

  • jn2002dkjn2002dk Member Posts: 102
    Store the angle at spawn attribute in a local attribute and use that for moving that particular actor
  • cibramcibram Member Posts: 7
    Hmm how to store it? Can you give an example?
  • cibramcibram Member Posts: 7
    Make a local attribute in the actor you want to control, you could call it localAngle, and when the actor spawns set this.localAngle = the angle from your formula

    Then you use localAngle to control the direction of your actor

    Not at my GS computer right now so can't make an example
    Thanks alot! I think i get it now, thank you so much!
  • jn2002dkjn2002dk Member Posts: 102
    np:)

    Let me know if you run into problems with it
Sign In or Register to comment.