add gameover #20

Merged
LuckyTurtleDev merged 4 commits from gameover into main 2024-07-07 16:46:29 +00:00
2 changed files with 36 additions and 38 deletions
Showing only changes of commit 612d9e4913 - Show all commits

View file

@ -1,11 +1,10 @@
use super::{furniture::Furniture, grid::Grid};
use crate::game::{self, ZLayer};
use comfy::{
draw_rect, draw_rect_outline, draw_sprite, error, random_i32, vec2, EngineContext,
HashSet, RandomRange as _, Vec2, GREEN, PURPLE, RED, WHITE,
draw_rect, draw_rect_outline, draw_sprite, error, random_i32, texture_id, vec2,
EngineContext, HashSet, RandomRange as _, Vec2, GREEN, PURPLE, RED, WHITE
};
use indexmap::IndexSet;
use comfy::texture_id;
pub const SCALE: f32 = 4.0;

View file

@ -76,7 +76,7 @@ pub enum ZLayer {
Human = 0,
Ghost = 1,
UI = 100,
GameOver = 1000,
GameOver = 1000
}
impl From<ZLayer> for i32 {
@ -135,7 +135,6 @@ pub const HOUSE_DISCHARGE_RATE: f32 = 30.0;
pub const GHOST_CHARGE_RATE: f32 = 200.0;
pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
if state.ghost.charge > 0.0 {
// Update the score. It's based on time.
state.score += ctx.delta * 10.0;
@ -171,8 +170,8 @@ pub fn update(state: &mut State, ctx: &mut EngineContext<'_>) {
},
_ => {}
}
}}
else {
}
} else {
crate::game_over::update(state, ctx);
}