commit 195ad8e997bf6ecf910a3ee185ecbbdb89f69cd4
parent ecaaf15dc8b2d022c0db86ac836790b71cf0e415
Author: brookjeynes <me@brookjeynes.dev>
Date: Thu, 13 Aug 2026 13:05:10 +1000
feat: spawn blorb after 60seconds
Signed-off-by: brookjeynes <me@brookjeynes.dev>
Diffstat:
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/src/constants.zig b/src/constants.zig
@@ -4,3 +4,8 @@ pub const screen_width: u16 = 800;
pub const screen_height: u16 = 1000;
pub const screen_title: [*]const u8 = "1.44mb game jam";
pub const fps: u8 = 60;
+
+pub const blorb_spawn_time: f32 = 5.0;
+pub const grunt_spawn_time: f32 = 0.7;
+
+pub const spawn_blorb_after: f32 = 60;
diff --git a/src/state.zig b/src/state.zig
@@ -28,8 +28,8 @@ pub const GameState = struct {
enemies: [constants.max_enemies]Entity,
enemy_count: u8,
- grunt_spawn_time: Timer = .{ .duration = 0.7 },
- blorb_spawn_time: Timer = .{ .duration = 5.0 },
+ grunt_spawn_time: Timer = .{ .duration = constants.grunt_spawn_time },
+ blorb_spawn_time: Timer = .{ .duration = constants.blorb_spawn_time },
pub fn init() GameState {
return .{
@@ -77,8 +77,9 @@ pub const GameState = struct {
self.enemy_count = 0;
self.enemies_killed = 0;
- self.grunt_spawn_time = .{ .duration = 0.7 };
- self.blorb_spawn_time = .{ .duration = 5.0 };
+
+ self.grunt_spawn_time = .{ .duration = constants.grunt_spawn_time };
+ self.blorb_spawn_time = .{ .duration = constants.blorb_spawn_time };
self.upgrades.apply(&self.player);
self.player.health = self.player.max_health;
@@ -97,8 +98,8 @@ pub const GameState = struct {
const delta = raylib.GetFrameTime();
self.time += delta;
- self.grunt_spawn_time.duration = @max(0.15, 0.7 / difficulty);
- self.blorb_spawn_time.duration = @max(0.15, 5.0 / difficulty);
+ self.grunt_spawn_time.duration = @max(0.15, constants.grunt_spawn_time / difficulty);
+ self.blorb_spawn_time.duration = @max(0.15, constants.blorb_spawn_time / difficulty);
self.player.tick();
if (self.player.health <= 0) {
@@ -121,16 +122,18 @@ pub const GameState = struct {
self.spawn_enemy(grunt);
}
- if (self.blorb_spawn_time.tick(delta)) {
- const blorb = createEnemy(
- .{ .x = constants.screen_width, .y = constants.screen_height },
- self.player,
- difficulty,
- .blorb,
- Blorb.size,
- );
-
- self.spawn_enemy(blorb);
+ if (self.time > constants.spawn_blorb_after) {
+ if (self.blorb_spawn_time.tick(delta)) {
+ const blorb = createEnemy(
+ .{ .x = constants.screen_width, .y = constants.screen_height },
+ self.player,
+ difficulty - constants.spawn_blorb_after,
+ .blorb,
+ Blorb.size,
+ );
+
+ self.spawn_enemy(blorb);
+ }
}
var enemy_idx: u8 = 0;