remove old logics
This commit is contained in:
+7
-7
@@ -89,13 +89,12 @@ pub fn debug_game_over(
|
||||
// player: Single<(&mut Transform, &mut Velocity, &mut Sprite), With<Player>>,
|
||||
input: Res<ButtonInput<KeyCode>>,
|
||||
mut fall_started: ResMut<FallStarted>,
|
||||
// mut regenerate_obstacles: ResMut<RegenerateObstacles>,
|
||||
mut next_state: ResMut<NextState<GameState>>, // For debug gameover state
|
||||
) {
|
||||
// let (mut transform, mut velocity, mut sprite) = player.into_inner();
|
||||
|
||||
// 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);
|
||||
// velocity.0 = Vec2::ZERO;
|
||||
// sprite.color = Color::WHITE;
|
||||
@@ -103,13 +102,14 @@ pub fn debug_game_over(
|
||||
fall_started.0 = false;
|
||||
next_state.set(GameState::GameOver);
|
||||
// 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>>) {
|
||||
commands.entity(*player).despawn();
|
||||
}
|
||||
@@ -118,7 +118,7 @@ pub struct PlayerPlugin;
|
||||
|
||||
impl Plugin for PlayerPlugin {
|
||||
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>()
|
||||
.add_systems(
|
||||
Update,
|
||||
|
||||
Reference in New Issue
Block a user