GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

animation help

zombotszombots Posts: 186Member
edited 8:28PM in Working with GS (Mac)
i have an actor that follows the main player and i want it to animate when it walks left or right.
like if the actor is moveing right play the right animation and if its moving left play the left animation.
does anybody have any ideas on how to do this?

Comments

  • harrioharrio Posts: 234Member
    what's cookin,

    i think you could try basing the actor animations on the keypress of the player.

    something like: if player pressing left key then actor runs the left animation.
  • zombotszombots Posts: 186Member
    sorry i didnt explain that the best im using Chasing the actor from
    http://gamesalad.com/wiki/how_to_gsc_follow_another_actor
    and i got a few actors that move towards the position of the player.
    i need it to still animate if the player stop but the other actor is still moving towards him if that makes sense?
  • KamazarKamazar Posts: 287Member
    Gah, I posted after you added details. ... is there a way to track an actor's direction? The only way I know is to find the difference between the actor's position at one point in time and then again at another, and whether or not the answer's negative or positive would define what direction it's going, but yeah... kinda complicated.
  • CodeMonkeyCodeMonkey Posts: 1,803Head Chef, Member, PRO
    You could check if the self.Motion.LinearVelocity.X is less than 0, then it is moving left and do that animation, etc...
  • zombotszombots Posts: 186Member
    thanks heaps codemonkey
This discussion has been closed.