Is there a way to ease the movements of an actor so they don't instantly start and stop?

grierdillgrierdill Member Posts: 16
edited August 2012 in Working with GS (Mac)
I'm using the really simple, "change attribute self.linear velocity," to move my player around and was wondering how to ease the start and stop of the movement, almost as if they were walking on ice. I'm experimenting with "interpolate" but it seems to mess up the movement more than it helps. Cool, any help would be awesome, totally new to GS.

Answers

  • MobileRocketGamesMobileRocketGames Member Posts: 128
    edited August 2012
    Using an interpolate to adjust the linear velocity works just fine and would give you control over how long it takes to accelerate to its maximum velocity. The problem with interpolates is they can't be affected while they are doing whatever it is we tell them to do.

    A probably less problematic way would be not to adjust the actors linear velocity directly, but use a move behavior. This will give you less control but will be easier to create a movement system. you will need to create a counter system that slows the actor to a halt when the user is not pressing the joystick/screen or whatever.

    Obviously we don't know what you are trying to accomplish though. "move my player around" is very vague. There's probably a much more efficient way of accomplishing what you'd like.
  • grierdillgrierdill Member Posts: 16
    Hmmmm, when I use the move behavior I don't see how I can apply that easing in and out motion. I've been also trying to use the accelerate behavior, which almost gets me to a good place but then I still don't know how to control how long the acceleration/deceleration takes (normally too slow)

    Basically I'm trying to create a pretty traditional sidescrolling platformer, with nice smooth controls. Since I'm just starting, I don't really know the "best practices" with the program, things to avoid, or behaviors that'll cause more problems later on.

    Thanks for the tip though, I'll keep trying different things
  • MotherHooseMotherHoose Member Posts: 2,456
    remember once getting an iceSkating effect with Accelerate Toward behavior
    aha! I found it!

    simple demo: http://www.mediafire.com/?xc7qb38n97o31c4

    image MH
  • dmilinovichiiidmilinovichiii Member Posts: 620
    If you use accelerate and set a max speed, I think that would create the effect that you are looking for.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Accelerate would be how you gradually increase speed and the friction and/or drag would be how you would decelerate when your accelerate stops.

    Also as @mr.rinoy said if you don't want it to keep accelerating to super fast speed then set and apply a max speed in the actor attributes.

    Cheers
  • grierdillgrierdill Member Posts: 16
    Well I was messing around for a while with it today and I think I got something to work, even though it might be overly complicated. Basically I couldn't use the Max Speed because when the actor is jumping the gravity was too slow, so it looked like he was floating down.

    I did use the accelerate and friction to speed up and slow down, but instead of the attribute Max Speed, I made a new a speed limit rule so if the actor's linear velocityX is ≥ 200, for the linear velocityX to = 200 this way the linear velocityY won't be affected when he jumps or falls.

    Now I'm just trying to tweak it because when the actor jumps and lands on the ground, it re-accelerates from 0, giving it this little hiccup. So I'm trying to make it recognize if the actor is already moving and if so than just Change Attribute, linear velocity, but if the actor is still, then use accelerate. Its not working perfectly yet, but getting there.

  • joshiwujoshiwu Member Posts: 207
    edited July 2013
    I'm using the really simple, "change attribute self.linear velocity," to move my player around and was wondering how to ease the start and stop of the movement, almost as if they were walking on ice. I'm experimenting with "interpolate" but it seems to mess up the movement more than it helps. Cool, any help would be awesome, totally new to GS.
    @grierdill
    goto moving actor and change the Drag attribute in the physics section to 0. this makes it infinitely slippery . then instead of using interpolate or constraint attribute use the accelerate or accelerate towards.

    can i get an "insightful"
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    @joshiwu, do you realize the last comment on this thread was a year ago?
Sign In or Register to comment.