Stay Facing Direction?

I've been stuck on this for weeks.

How do I keep my actor to STAY facing right when it is finished moving right, and STAY facing left when it is finished moving left?

PLEASE help.

Best Answers

  • chad.allenchad.allen Posts: 9
    Accepted Answer

    Use flip horizontal.

    Rule - when self.motion.linearVelocityX > 0

    • change attribute self.graphics.flip horizontal to true
      Rule - when self.motion.linearVelocityX < 0

    • change attribute self.graphics.flip horizontal to false

    I am currently using this method. It works well.

  • chad.allenchad.allen Posts: 9
    edited September 2014 Accepted Answer

    Also, add in a rule for

    Rule - when self.motion.linearVelocityX = 0 - change attribute self.graphics.flip horizontal to self.graphics.flip horizontal

    So it accounts for the time its not moving

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    With the information you've provided, I have no idea how to help you. Are you using Move, Move To, Interpolate, or some other behavior to make your actors move? And how are you changing the direction they are facing? Are you using the flip horizontal attribute, changing the image, using an animate behavior, or some other method?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • loganflahartyloganflaharty Member Posts: 2

    It's an app for iOS landscape. There are 4 arrows in the bottom left that when touched activate one of 4 move attributes, (up,down,left, or right), turning them to true. When these attributes become true, the actor moves in said direction until a collision occurs, or the touch is released from the arrows. My actor faces right on default, and when he walks right there is a walk right animation that works fine, and when he walks left, the walk left animation also looks fine. The PROBLEM is that when the actor isn't moving left, it instantly switches to face back right again, instead of facing left. That's it. I hope I've made myself more clear now.

Sign In or Register to comment.