summaryrefslogtreecommitdiffhomepage
path: root/src/main.c
diff options
context:
space:
mode:
authorarngo <[email protected]>2023-05-30 13:37:17 -0400
committerarngo <[email protected]>2023-05-30 13:37:17 -0400
commitc43ac3e4ce4375b6fa1fa9927e20ff4f88504429 (patch)
treee8eab43f3597f5c55942b06ae55a8a95ff654528 /src/main.c
parent91e22bf324b34ef2e66dcec73f2cd85cf8887ef5 (diff)
downloadTOJam2023-c43ac3e4ce4375b6fa1fa9927e20ff4f88504429.tar.gz
TOJam2023-c43ac3e4ce4375b6fa1fa9927e20ff4f88504429.zip
implement enemy counting and prevent spawning when num enemies > 50
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index cffe740..0b68cca 100644
--- a/src/main.c
+++ b/src/main.c
@@ -45,7 +45,11 @@ main_loop(void)
player_shoot(get_player_bullet_world());
enemies_attempt_weapon_fire();
- attempt_random_enemy_spawn((rodeo_rectangle_t){ 0, 0, window_width, window_height });
+ if (get_enemy_count() < 50)
+ {
+ attempt_random_enemy_spawn((rodeo_rectangle_t){ 0, 0, window_width, window_height });
+ }
+
group_follow_target(get_player_position());
@@ -87,6 +91,13 @@ main_loop(void)
" fps: %.2f ",
time_var
);
+
+ rodeo_debug_text_draw(
+ 2,
+ 4,
+ " enemy count: %d ",
+ get_enemy_count()
+ );
}
}
@@ -126,10 +137,10 @@ main(void)
{
wall_init_do()
{
- spawn_enemy(400.0f,700.0f);
- spawn_enemy(900.0f,700.0f);
- spawn_enemy(400.0f,100.0f);
- spawn_enemy(900.0f,100.0f);
+ //spawn_enemy(400.0f,700.0f);
+ //spawn_enemy(900.0f,700.0f);
+ //spawn_enemy(400.0f,100.0f);
+ //spawn_enemy(900.0f,100.0f);
rodeo_mainLoop_run(
main_loop
);