Skip to content

Commit

Permalink
better entity movement
Browse files Browse the repository at this point in the history
  • Loading branch information
Kade-github committed May 24, 2024
1 parent 15cfca2 commit 918a8d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/Game/Objects/Base/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,6 @@ void Entity::Draw()

float sped = speed;

if (shift)
sped /= 4;

if (strafeVelocity > sped / Game::instance->deltaTime)
strafeVelocity = sped / Game::instance->deltaTime;
Expand All @@ -539,6 +537,12 @@ void Entity::Draw()
if (forwardVelocity < -sped / Game::instance->deltaTime)
forwardVelocity = -sped / Game::instance->deltaTime;

if (shift)
{
forwardVelocity *= 0.9;
strafeVelocity *= 0.9;
}


motion += front * (forwardVelocity * Game::instance->deltaTime);

Expand Down
2 changes: 1 addition & 1 deletion src/Game/Objects/Base/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Entity : public GameObject
bool inWater = false;

float gravity = 22.0f;
float jumpStrength = 6.8f;
float jumpStrength = 7.4f;
float speed = 9.0f;

bool tiny = false;
Expand Down

0 comments on commit 918a8d3

Please sign in to comment.