diff options
| author | esquizo <esquizo+noreply@esquizo.net> | 2026-05-09 01:01:18 -0300 |
|---|---|---|
| committer | esquizo <esquizo+noreply@esquizo.net> | 2026-05-09 01:01:18 -0300 |
| commit | 5c6b3c19172948cf2e1800a9333cfcd858ee829c (patch) | |
| tree | b8da3f436cba5736d481690935135fe5c6b3badc /physics.c | |
| parent | a21ae8219e67783c52ba5f415e1ca4745755adb5 (diff) | |
adicionado vecmath.h
Diffstat (limited to 'physics.c')
| -rw-r--r-- | physics.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -2,6 +2,7 @@ #include <stdbool.h> #include <stddef.h> +#include <vecmath.h> #include "dat.h" static void mink(Body *a, Body *b, float *minx, float *miny, float *maxx, float *maxy); @@ -43,8 +44,7 @@ entphysics(float delta) if(!e->active) continue; - for(int j = 0; j < 2; j++) - e->body.pos[j] += e->body.vel[j] * delta; + vec2_add_scaled(e->body.pos, e->body.pos, e->body.vel, delta); } } @@ -157,8 +157,7 @@ mapcollision(Body *a) float p[2]; resolvecoll(a, &b, p); - for(int i = 0; i < 2; i++) - a->pos[i] -= p[i]; + vec2_sub(a->pos, a->pos, p); if(p[0] != 0.0) { a->vel[0] = 0; |
