From f9fea0e6137423a9200d91c568d3577155a1e9f1 Mon Sep 17 00:00:00 2001 From: huaqo-games Date: Wed, 19 Mar 2025 17:27:31 +0100 Subject: [PATCH] direction normalization, target -> direction --- .vscode/settings.json | 5 ----- src/engine/physics.h | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index e5189ba..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "menu.h": "c" - } -} \ No newline at end of file diff --git a/src/engine/physics.h b/src/engine/physics.h index 94d2e85..75a5374 100644 --- a/src/engine/physics.h +++ b/src/engine/physics.h @@ -9,7 +9,7 @@ typedef struct { } Physics; void UpdatePhysicsDirection(Vector2 *direction, Vector2 vector){ - *direction = vector; + *direction = Vector2Normalize(vector); } void UpdatePhysicsVelocity(Vector2 *velocity, Vector2 *direction, float *speed){ @@ -24,8 +24,8 @@ void UpdatePhysicsSpeed(float *speed, float *newSpeed){ *speed = *newSpeed; } -void UpdatePhysics(Physics *physics, Vector2 target){ - UpdatePhysicsDirection(&physics->direction, target); +void UpdatePhysics(Physics *physics, Vector2 direction){ + UpdatePhysicsDirection(&physics->direction, direction); UpdatePhysicsVelocity(&physics->velocity, &physics->direction, &physics->speed); UpdatePhysicsPosition(&physics->position, &physics->velocity); }