Ramlogic-Lappland / Delving-Into-Darkness

Asteroids like game
0 stars 0 forks source link

Character is attached to frame speed #2

Closed Stevendotcom closed 1 month ago

Stevendotcom commented 1 month ago

if you comment line Delving_Into_Darkness.cpp:23 the character can accelerate a lot more, and can also gain istant speed. In line 72-73 of game.cpp you use:

player.speed.x += dirVector.x * player.acceleration;                
player.speed.y += dirVector.y * player.acceleration;

and should be:

player.speed.x += dirVector.x * player.acceleration * GetFrameTime();               
player.speed.y += dirVector.y * player.acceleration * GetFrameTime();

You also apply it to

player.playerRect.x += player.speed.x * GetFrameTime();
player.playerRect.y += player.speed.y * GetFrameTime();

but next frame the speed is not update, so the issue gets compund.