add gameover #20
2 changed files with 36 additions and 38 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue