diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-21 21:17:54 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-21 21:17:54 +0100 |
commit | 4beddb454cce722d31a889145ae4877071bd487e (patch) | |
tree | 1606d36dd9502195c50d556153ea0f81809c645f /src | |
parent | 176ed005d8bef40bd8fbf7e7bb82536fa7286ba9 (diff) | |
download | hyperultra-4beddb454cce722d31a889145ae4877071bd487e.tar.gz |
exit direction
Diffstat (limited to 'src')
-rw-r--r-- | src/exit.c | 3 | ||||
-rw-r--r-- | src/exit.h | 2 | ||||
-rw-r--r-- | src/game.c | 5 |
3 files changed, 7 insertions, 3 deletions
@@ -7,10 +7,11 @@ IMPL_UPDATE() { IMPL_DRAW() { LZY_DrawSetColor(BLACK); rotrect(this->pos[0], this->pos[1], - this->width, this->height, 0.2); + this->width, this->height, 0.2 * this->exit.dir); } IMPL_END IMPL_INIT(exit) { this->width = 12; this->height = 12; + this->exit.dir = 1; } IMPL_END @@ -1,7 +1,7 @@ #pragma once typedef struct { - int _; + int dir; } Exit; struct Entity; @@ -58,12 +58,15 @@ game_restart_scene(Game *this) for (int x = 0; x < map_width(); x++) { const int dx = x * TSIZE + TSIZE / 2; const int dy = y * TSIZE + TSIZE / 2; + Entity *e; switch (map_get(x, y)) { case 2: player_init(game_create_entity(this), dx, dy); break; + case 3: case 4: - exit_init(game_create_entity(this), dx, dy); + e = exit_init(game_create_entity(this), dx, dy); + e->exit.dir = (map_get(x, y) == 3) ? -1 : 1; break; case 5: spike_init(game_create_entity(this), dx, dy); |