medfall

A super great game engine
Log | Files | Refs

commit cec7908f2a59fc9531409ad9925ee951a36c251b
parent f127c7ed142605a2907095278fc61166ffb01767
Author: Michael Savage <mikejsavage@gmail.com>
Date:   Sun, 19 Nov 2017 12:27:47 +0200

Tweak acceleration

Diffstat:
clipmap.cc | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/clipmap.cc b/clipmap.cc @@ -438,16 +438,16 @@ GAME_FRAME( game_frame ) { } } - const float acceleration = 12; + const float acceleration = 20.0f; + const float deceleration = 1.2f; if( game->on_ground ) { // apply friction - if( dot( game->velocity, game->velocity ) < 0.01 ) { - game->velocity.x = 0; - game->velocity.y = 0; + if( dot( game->velocity, game->velocity ) < 0.01f ) { + game->velocity = v3( 0 ); } else { float current_speed = length( game->velocity ); - float drop = max( acceleration, current_speed ) * acceleration * dt / 6.0f; + float drop = max( acceleration, current_speed ) * deceleration * dt; float new_speed = max( 0.0f, current_speed - drop ); game->velocity = new_speed * ( game->velocity / current_speed ); }