summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game.c2
-rw-r--r--src/game.h1
-rw-r--r--src/spike.c5
3 files changed, 5 insertions, 3 deletions
diff --git a/src/game.c b/src/game.c
index 877385a..31ac01b 100644
--- a/src/game.c
+++ b/src/game.c
@@ -23,6 +23,8 @@ game_deinit(Game *this)
void
game_update(Game *this)
{
+ extern double tick;
+ this->spike_angle = tick / 16;
if (this->queue_restart_scene > 0) {
if (--this->queue_restart_scene == 0)
game_restart_scene(this);
diff --git a/src/game.h b/src/game.h
index 001d467..b8dae9f 100644
--- a/src/game.h
+++ b/src/game.h
@@ -8,6 +8,7 @@ typedef struct Game {
bool queue_next_scene;
int queue_restart_scene;
int player_dir;
+ double spike_angle;
Entity entities[MAX_ENTITIES];
} Game;
diff --git a/src/spike.c b/src/spike.c
index 3c5a8d3..f09537f 100644
--- a/src/spike.c
+++ b/src/spike.c
@@ -7,9 +7,8 @@ IMPL_UPDATE() {
} IMPL_END
IMPL_DRAW() {
- const double angle = tick / 16;
- rotrect(this->pos[0], this->pos[1], 10, 10, angle);
- rotrect(this->pos[0], this->pos[1], 10, 10, -angle);
+ rotrect(this->pos[0], this->pos[1], 10, 10, g->spike_angle);
+ rotrect(this->pos[0], this->pos[1], 10, 10, -g->spike_angle);
} IMPL_END
IMPL_INIT(spike) {