seed reset on go

This commit is contained in:
2026-09-19 12:17:41 +02:00
parent c0ed583d5a
commit 33cbdb5443
+11 -5
View File
@@ -1,6 +1,6 @@
use bevy::prelude::*;
use crate::{camera::MainCamera, game_state::GameState};
use crate::{camera::MainCamera, game_state::GameState, world::RunSeed};
// To delete game over's components
#[derive(Component)]
@@ -48,15 +48,21 @@ fn cleanup_game_over(mut commands: Commands, game_over: Query<Entity, With<GameO
}
}
fn game_over_input(input: Res<ButtonInput<KeyCode>>, mut next_state: ResMut<NextState<GameState>>) {
// For debug bug same logic on collision (will be renamed)
fn game_over_input(
input: Res<ButtonInput<KeyCode>>,
mut run_seed: ResMut<RunSeed>,
mut next_state: ResMut<NextState<GameState>>,
) {
if input.just_pressed(KeyCode::KeyN) {
// TODO: Restart with completely reseting the game state (OnEnter maybe)
// New seed
run_seed.0 = rand::random::<u64>();
next_state.set(GameState::InGame);
} else if input.just_pressed(KeyCode::KeyR) {
// TODO: restart with the same seed
// Same seed
next_state.set(GameState::InGame);
} else if input.just_pressed(KeyCode::KeyT) {
// TODO: Clear all of the game asset (OnExit)
// Return to the Main Menu
next_state.set(GameState::MainMenu);
}
}