How to keep an actor at a constant speed?

memski425memski425 Member Posts: 19
edited August 2012 in Working with GS (Mac)
Hello gamesalad community,
I was wondering how to create movement in which the actor is at consistent speed when the left or right arrow is pressed. I have tried to make the actor move, however it always gained speed and dragged along the ground after holding and releasing the arrows. Please help

Best Answer

  • StoneclipseStoneclipse Posts: 130
    Accepted Answer
    create a moveright and moveleft boolean atrributes. When rightbutton is pressed, change moveright to true, otherwise when rightbutton is released, change moveright to false. Same thing for left button.

    In the character actor, have a rule says when moveright is true, constrain self.movement.linear.x to, for example 80(depends on how fast you want your actor to move), otherwise x = 0. Then when moveleft is true, x = -80, otherwise x = 0.
Sign In or Register to comment.