remove old logics

This commit is contained in:
2026-09-19 12:50:30 +02:00
parent 33cbdb5443
commit 1a850787c7
+7 -7
View File
@@ -89,13 +89,12 @@ pub fn debug_game_over(
// player: Single<(&mut Transform, &mut Velocity, &mut Sprite), With<Player>>, // player: Single<(&mut Transform, &mut Velocity, &mut Sprite), With<Player>>,
input: Res<ButtonInput<KeyCode>>, input: Res<ButtonInput<KeyCode>>,
mut fall_started: ResMut<FallStarted>, mut fall_started: ResMut<FallStarted>,
// mut regenerate_obstacles: ResMut<RegenerateObstacles>,
mut next_state: ResMut<NextState<GameState>>, // For debug gameover state mut next_state: ResMut<NextState<GameState>>, // For debug gameover state
) { ) {
// let (mut transform, mut velocity, mut sprite) = player.into_inner(); // let (mut transform, mut velocity, mut sprite) = player.into_inner();
// R key for reset or player has collider // R key for reset or player has collider
if input.just_pressed(KeyCode::KeyR) { if input.just_pressed(KeyCode::KeyG) {
// transform.translation = Vec3::new(START_POSITION.x, START_POSITION.y, START_POSITION.z); // transform.translation = Vec3::new(START_POSITION.x, START_POSITION.y, START_POSITION.z);
// velocity.0 = Vec2::ZERO; // velocity.0 = Vec2::ZERO;
// sprite.color = Color::WHITE; // sprite.color = Color::WHITE;
@@ -103,13 +102,14 @@ pub fn debug_game_over(
fall_started.0 = false; fall_started.0 = false;
next_state.set(GameState::GameOver); next_state.set(GameState::GameOver);
// TODO: uncomment when obstacle chunk logic is implemented // TODO: uncomment when obstacle chunk logic is implemented
// regenerate_obstacles.0 = true;
} else if input.just_pressed(KeyCode::KeyG) {
// Temporary test for gameover state
next_state.set(GameState::GameOver);
} }
} }
// To freeze player at the begining of the Ingame
fn start_run(mut fall_started: ResMut<FallStarted>) {
fall_started.0 = false;
}
fn cleanup_player(mut commands: Commands, player: Single<Entity, With<Player>>) { fn cleanup_player(mut commands: Commands, player: Single<Entity, With<Player>>) {
commands.entity(*player).despawn(); commands.entity(*player).despawn();
} }
@@ -118,7 +118,7 @@ pub struct PlayerPlugin;
impl Plugin for PlayerPlugin { impl Plugin for PlayerPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems(OnEnter(GameState::InGame), spawn_player) app.add_systems(OnEnter(GameState::InGame), (spawn_player, start_run))
.init_resource::<FallStarted>() .init_resource::<FallStarted>()
.add_systems( .add_systems(
Update, Update,