how to make an actor not slide when moving

bgappsbgapps Member Posts: 183
edited November -1 in Working with GS (Mac)
i making a platform game and whenever i stop moving my actor slides. How do i make it so that when i done pressing left or right key the actor does not continue to move.

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Depends on the rule your using to move. but You can try adding friction to the actor. If its an accelerate rule I believe you need drag and friction. or you can do an otherwise to you button down rule that sets the velocity back to 0 but that may give too sudden of a stop.
  • bgappsbgapps Member Posts: 183
    i dont get how you could do the otherwise...
    when i out that in did the same thing it did before
  • bgappsbgapps Member Posts: 183
    what is the purpose of the friction and drag
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    When key right is down
    --accelerate toward
    Then in other wise
    change attribute self.linearvelocity.x to 0

    That would give you an abrupt stop. so if you didn't want that you could put in
    interpolate attribute self.linearvelocity.x to 0
    -duration .25 or .5 and then in function do ease in. this will cause the velocity to come back to 0 over what ever time period you set.

    But what are you moving does the move behavior not work for you I believe it would actually stop as soon as you let the key up eliminating the need for the otherwise.
  • bgappsbgapps Member Posts: 183
    i got it now thanks
Sign In or Register to comment.