Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Non-Sliding Character Movement

Author
Message
anwserman
15
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 8th Aug 2011 14:25
How can I go about making a character increase movement speed but without it feeling like the player is on ice? I've typically just increased/decreased per frame with some value multiplied against time since last frame.

E.g., PlayerSpeed = PlayerSpeed + (movementValue * TimeElapsed)

Thus, the player moves faster, but it seems 'slippery'. I'm thinking that I could so something similar, but give it a ranged value instead - if the 'movement' speed falls within a certain range, player moves at a fixed rate X.



So, the player's 'movement' is at 18. Since it's between 15 and 30, the player moves at a fixed 22.5 units. When the player's 'movement' moves down to 12, he moves at just 7.5.

Does this sound accurate? I think it would get rid of the slipperyness in character movement...
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Aug 2011 14:28
ActualSpeed# = curvevalue(TargetSpeed#, ActualSpeed#, Smooth#)

I prefer to use a value of around 8 for Smooth#

TheComet

anwserman
15
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 8th Aug 2011 15:28
Heh.
Thanks for the quick reply TheComet! I'm sure the values work based upon your own world-scale system?
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 8th Aug 2011 16:19
No problem

Quote: "I'm sure the values work based upon your own world-scale system?"


curvevalue() is an exponential function, so what it calculates is entirely ralitive to what you input. For example, curvevalue(200,100,10) would take just as long to reach it's half-life (150) as curvevalue(2,1,10) would take to reach it's half life (1.5). So in short : YES

TheComet

anwserman
15
Years of Service
User Offline
Joined: 20th May 2011
Location: Wisconsin
Posted: 8th Aug 2011 16:31
Haha, thanks Comet

Hi there. My name is Dug. I have just met you, and I love you.

Login to post a reply

Server time is: 2026-07-10 15:31:48
Your offset time is: 2026-07-10 15:31:48