diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-19 01:37:14 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-19 01:37:14 +0100 |
commit | fd2c1baa4edc4a99ff3752f86267ae98f017a77b (patch) | |
tree | 1b7615052e56cb641e52db663f1b9b46c6cef35e /src | |
parent | 56d1c26ede4e9641addc6aaed90d5055fd9db9d2 (diff) | |
download | hyperultra-fd2c1baa4edc4a99ff3752f86267ae98f017a77b.tar.gz |
spikes!
Diffstat (limited to 'src')
-rw-r--r-- | src/background.c | 1 | ||||
-rw-r--r-- | src/game.c | 4 | ||||
-rw-r--r-- | src/player.c | 4 | ||||
-rw-r--r-- | src/spike.c | 5 |
4 files changed, 13 insertions, 1 deletions
diff --git a/src/background.c b/src/background.c index 03730e8..fc3b1ba 100644 --- a/src/background.c +++ b/src/background.c @@ -1,6 +1,7 @@ #include "lzy.h" #include "cfg.h" #include "rotrect.h" +#include <math.h> long tick = 0; @@ -3,6 +3,7 @@ #include "map.h" #include "player.h" #include "cfg.h" +#include "spike.h" #include <string.h> void @@ -64,6 +65,9 @@ game_restart_scene(Game *this) case 4: exit_init(game_create_entity(this), dx, dy); break; + case 5: + spike_init(game_create_entity(this), dx, dy); + break; default: break; } diff --git a/src/player.c b/src/player.c index f5a824f..3af2dfc 100644 --- a/src/player.c +++ b/src/player.c @@ -1,4 +1,5 @@ #include "deathpart.h" +#include "entity.h" #include "entityimpl.h" #include "game.h" #include "input.h" @@ -44,7 +45,8 @@ IMPL_UPDATE() { if (this->vel[0] == 0.0 && this->vel[1] >= -0.0) this->player.dirx *= -1; - if (this->bonk_ceiling) { + if (this->bonk_ceiling || + entity_place_meeting(this, g, ET_spike) != NULL) { int dy = this->pos[1] - 6; for (int y = 0; y < 7; y++) { int dx = this->pos[0] - 6; diff --git a/src/spike.c b/src/spike.c index 4fb7a47..4173729 100644 --- a/src/spike.c +++ b/src/spike.c @@ -1,4 +1,5 @@ #include "entityimpl.h" +#include "rotrect.h" extern long tick; @@ -6,7 +7,11 @@ IMPL_UPDATE() { } IMPL_END IMPL_DRAW() { + const double angle = (float)tick / 16; + rotrect(this->pos[0], this->pos[1], 10, 10, angle); + rotrect(this->pos[0], this->pos[1], 10, 10, -angle); } IMPL_END IMPL_INIT(spike) { + this->height = this->width = 8; } IMPL_END |