summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoresquizo <esquizo+noreply@esquizo.net>2026-05-03 12:34:13 -0300
committeresquizo <esquizo+noreply@esquizo.net>2026-05-03 12:34:13 -0300
commitc50ad43317e7c03740885af5e43cd4e2fa750348 (patch)
treef75b896c4e6be799843a7ddfd0cbc5fd409e6e69
parent2416783679eafe35aea7af15bf1308a6895e251a (diff)
alguns consertos na logica
-rw-r--r--game.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/game.c b/game.c
index 692f076..eba5244 100644
--- a/game.c
+++ b/game.c
@@ -11,6 +11,7 @@
static EntityCollisionProc bulletcollproc;
static EntityUpdateProc playerproc;
static EntityUpdateProc ghostproc;
+static EntityUpdateProc bulletproc;
static EntityCollisionProc *collisionProcs[LASTEntity] = {
[EBULLET] = bulletcollproc,
@@ -19,6 +20,7 @@ static EntityCollisionProc *collisionProcs[LASTEntity] = {
static EntityUpdateProc *updateprocs[LASTEntity] = {
[EPLAYER] = playerproc,
[EGHOST] = ghostproc,
+ [EBULLET] = bulletproc,
};
Entity entitybuffer[2048];
@@ -150,8 +152,8 @@ ghostproc(Entity *e, float delta)
dy /= dd;
if(dd < 40) {
- vx -= dx * 100;
- vy -= dy * 100;
+ vx -= dx * SPEED;
+ vy -= dy * SPEED;
}
}
@@ -159,6 +161,12 @@ ghostproc(Entity *e, float delta)
e->body.vel[1] = vy;
}
+void
+bulletproc(Entity *e, float delta)
+{
+ e->active = (e->time += delta) < 1.0;
+}
+
Entity *
allocentity(void)
{