diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-07-04 22:28:50 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-07-04 22:28:50 +0100 |
commit | 81efbd3a866fe3f99768b03c341b7b9d11dda9de (patch) | |
tree | 4dca4944c40c8800c198ab29d292ed3409b4a12b /src/game.c | |
parent | b0100ff9fc763c9d3e5a72155cfa8331a1c6ac3c (diff) | |
download | gold-mine-run-81efbd3a866fe3f99768b03c341b7b9d11dda9de.tar.gz gold-mine-run-81efbd3a866fe3f99768b03c341b7b9d11dda9de.zip |
Add time monster
Diffstat (limited to 'src/game.c')
-rw-r--r-- | src/game.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -10,6 +10,7 @@ #include "timer.h" #include "entities.h" +#include "tmonster.h" #include "player.h" #include "game.h" @@ -42,6 +43,7 @@ static uint8_t time; static uint8_t pickaxe; static uint8_t gameover; static uint8_t pause; +static Entity *tmonster; static void hud_render() { @@ -126,6 +128,7 @@ void run_game() stage = 0; pickaxe = 0; time = GAME_TIME_MAX; + tmonster = NULL; hud = HUD_ALL; @@ -189,6 +192,19 @@ void run_game() player_update(); entities_update(); + /* time monster */ + if (!time && !tmonster) + { + tmonster = entities_new(); + if (tmonster) + tmonster_init(tmonster); + } + if (time && tmonster) + { + tmonster->used = 0; + tmonster = NULL; + } + entities_draw(); player_draw(); |