summaryrefslogtreecommitdiff
path: root/game.c
diff options
context:
space:
mode:
authoresquizo <esquizo+noreply@esquizo.net>2026-06-03 19:34:09 -0300
committeresquizo <esquizo+noreply@esquizo.net>2026-06-03 19:34:09 -0300
commitb8e054b4dbd6ffc561eea0f56d6ded2523bf28f5 (patch)
tree190c96ba6e2617885fa2db9866512e0722713477 /game.c
parent94bdded9102bc2e2b2e4bded8f180749efda1b72 (diff)
game: teleporter agora teleporta (olha que legal)
Diffstat (limited to 'game.c')
-rw-r--r--game.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/game.c b/game.c
index a7ab79d..a3a1e66 100644
--- a/game.c
+++ b/game.c
@@ -11,13 +11,16 @@
static EntityCollisionProc bulletcollproc;
static EntityCollisionProc ghostcollproc;
+static EntityCollisionProc teleportercollproc;
+
static EntityUpdateProc playerproc;
static EntityUpdateProc ghostproc;
static EntityUpdateProc bulletproc;
static EntityCollisionProc *collisionProcs[LASTEntity] = {
- [EBULLET] = bulletcollproc,
- [EGHOST] = ghostcollproc,
+ [EBULLET] = bulletcollproc,
+ [EGHOST] = ghostcollproc,
+ [ETELEPORTER] = teleportercollproc,
};
static EntityUpdateProc *updateprocs[LASTEntity] = {
@@ -116,6 +119,20 @@ ghostcollproc(Entity *self, Entity *target)
}
void
+teleportercollproc(Entity *self, Entity *target)
+{
+ if(target->type == EPLAYER && target->alive) {
+ for(int i = 0; i < telemapsize; i++) {
+ if(self->telex == telemap[i].ftx && self->teley == telemap[i].fty) {
+ target->body.pos[0] = telemap[i].ttx * ENTITY_SIZE * 2;
+ target->body.pos[1] = telemap[i].tty * ENTITY_SIZE * 2;
+ break;
+ }
+ }
+ }
+}
+
+void
playerproc(Entity *e, float delta)
{
Entity *bullet;