From 8dded8c4bab1bbaf02bfc4818cf457be708f8a75 Mon Sep 17 00:00:00 2001 From: Luna Date: Sun, 3 Oct 2021 20:21:18 -0400 Subject: [PATCH] fixed timer --- game/src/scenes/level_select_screen.rs | 7 +++++++ game/src/scenes/main_menu_screen.rs | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/game/src/scenes/level_select_screen.rs b/game/src/scenes/level_select_screen.rs index 029d8a3..192f005 100644 --- a/game/src/scenes/level_select_screen.rs +++ b/game/src/scenes/level_select_screen.rs @@ -86,6 +86,13 @@ impl Action for LevelSelectScreen { .send(Some(ControlFlag::SwitchLevel(level))) .unwrap(); + context + .flag_send + .send(Some(ControlFlag::UpdateLevelStart( + Utc::now(), + ))) + .unwrap(); + // Enter the game Ok(ActionFlag::SwitchState(Scenes::InGameScene)) } else if self.is_btm_pressed { diff --git a/game/src/scenes/main_menu_screen.rs b/game/src/scenes/main_menu_screen.rs index 4092405..5b5511f 100644 --- a/game/src/scenes/main_menu_screen.rs +++ b/game/src/scenes/main_menu_screen.rs @@ -323,7 +323,7 @@ impl ScreenSpaceRender for MainMenuScreen { for (i, (level, time)) in times.iter() { let time = Duration::seconds(*time); raylib.draw_text( - &format!("Lvl {} {}:{}", level + 1, time.num_minutes(), time.num_seconds() % 60), + &format!("Lvl {} {}:{}", level, time.num_minutes(), time.num_seconds() % 60), screen_size.x as i32 - 200, 100 + (25 * (*i as i32)), 20, @@ -333,6 +333,5 @@ impl ScreenSpaceRender for MainMenuScreen { } self.is_quit_pressed = mouse_pressed && hovering_quit; - // for } }