Face direction of the swing

I have an actor that swings left and right, How do I make him face to the direction of the swing?

http://www.mediafire.com/download/w97cm9n7lvdgddq/swingingDemo.gameproj.zip

Comments

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

    I haven't looked at your project file yet but generally you would have a rule that changes or constrains the image (left-facing or right-facing) based on the velocity of the actor in a certain direction, most likely the X velocity in this case.

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

  • frank067frank067 Member Posts: 56

    I think I got it, but how do I change the actor to display Image upright? It keeps flipping upside down. Can you please take a look at the code, I'll post the final results if you can flip this image upright please.

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

    I checked out the project and I see that that actor is not changing its velocity but rather its rotation.

    Try this (the attribute in the screenshot if self.Graphics.Flip Horizontally):

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

  • frank067frank067 Member Posts: 56
    edited August 2014

    no luck but I got it to work with
    for left: Attribute:game.rotation > 45,Attribute:game.rotation<0
    Move directon=0
    Speed=300
    change image

    and repeat for right with rotation ,135 & 225
    thank you

Sign In or Register to comment.