diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-07-27 20:03:21 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-07-27 20:03:21 +0300 |
| commit | 02dac4318a278423f093261dd60d301729f3ead9 (patch) | |
| tree | 4c09c6a94a81e3de5e39f6025ff4dee6c9080bb3 /src | |
| parent | 2cede3f3fe56ef0d773c3e46dd1ad9644df6a409 (diff) | |
added skipped and comp time
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index 58f8668..66c5df9 100644 --- a/src/main.zig +++ b/src/main.zig @@ -1286,11 +1286,13 @@ const ScreenVictory = struct { animation_offset: f32 = 0.2, animation_size: f32 = 0.3, initiated: bool = false, + completion_time: f32, + skipped: bool, const button_menu_width: f32 = @floatFromInt(cell_size * 7); const button_menu_height: f32 = @floatFromInt(cell_size); - fn init() ScreenVictory { + fn init(completion_time: f32, skipped: bool) ScreenVictory { return .{ .camera = .{ .target = .{ .x = 128, .y = 128 }, @@ -1301,6 +1303,8 @@ const ScreenVictory = struct { .rotation = 0, .zoom = @as(f32, @floatFromInt(screen_height)) / world_height, }, + .completion_time = completion_time, + .skipped = skipped, }; } @@ -1424,7 +1428,8 @@ const ScreenBattle = struct { transistors: u32 = initial_cpu_transistor_cost, cpu_transistor_cost: u32 = initial_cpu_transistor_cost, wave_over_timer: f32 = 0, - + skipped: bool = false, + completion_time: f32 = 0, popup: bool = false, const max_ram = 100; @@ -1454,6 +1459,7 @@ const ScreenBattle = struct { } fn update(self: *ScreenBattle, game: *Game, dt: f32) void { + self.completion_time += dt; self.handlePlayerInput(game, dt); self.updateCpuAndBugs(game, dt); @@ -1474,7 +1480,7 @@ const ScreenBattle = struct { self.transistors = self.cpu_transistor_cost; if (self.wave_number > 3) { self.deinit(); - game.screen_state = .{ .victory = .init() }; + game.screen_state = .{ .victory = .init(self.completion_time, self.skipped) }; } else { self.wave.deinit(); self.wave = .init(self.wave_number); |
