summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkdx <kikoodx@paranoici.org>2023-03-19 01:37:14 +0100
committerkdx <kikoodx@paranoici.org>2023-03-19 01:37:14 +0100
commitfd2c1baa4edc4a99ff3752f86267ae98f017a77b (patch)
tree1b7615052e56cb641e52db663f1b9b46c6cef35e
parent56d1c26ede4e9641addc6aaed90d5055fd9db9d2 (diff)
downloadhyperultra-fd2c1baa4edc4a99ff3752f86267ae98f017a77b.tar.gz
spikes!
-rw-r--r--CMakeLists.txt2
-rw-r--r--map/idkwymlol.json2
-rw-r--r--map/weallstartsomewhere.json2
-rw-r--r--res/tset.pngbin236 -> 316 bytes
-rw-r--r--src/background.c1
-rw-r--r--src/game.c4
-rw-r--r--src/player.c4
-rw-r--r--src/spike.c5
8 files changed, 17 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1cc5221..dfa631c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,8 @@ set(SOURCES
src/main.c
src/map.c
src/player.c
+ src/rotrect.c
+ src/spike.c
)
set(ASSETS
diff --git a/map/idkwymlol.json b/map/idkwymlol.json
index 55ba8ff..9c849bd 100644
--- a/map/idkwymlol.json
+++ b/map/idkwymlol.json
@@ -1 +1 @@
-{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,1,0,0,1,0,0,1,1,1,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,1,1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1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]} \ No newline at end of file
diff --git a/map/weallstartsomewhere.json b/map/weallstartsomewhere.json
index 57f5963..b3fd04d 100644
--- a/map/weallstartsomewhere.json
+++ b/map/weallstartsomewhere.json
@@ -1 +1 @@
-{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,1,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]} \ No newline at end of file
+{"width":25,"height":14,"data":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,1,1,1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,1,0,2,0,0,0,5,0,0,0,0,1,0,1,1,1,0,0,5,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]} \ No newline at end of file
diff --git a/res/tset.png b/res/tset.png
index 481c648..e751df9 100644
--- a/res/tset.png
+++ b/res/tset.png
Binary files differ
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;
diff --git a/src/game.c b/src/game.c
index c7159ae..615e06e 100644
--- a/src/game.c
+++ b/src/game.c
@@ -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