Проектная работа - WIP
This commit is contained in:
@@ -16,6 +16,25 @@ pub fn print_all_entities_by_press_enter(input: Res<ButtonInput<KeyCode>>, mut c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// ДЛЯ ОТЛАДКИ - регулировка скорости игры
|
||||||
|
pub fn time_speed(input: Res<ButtonInput<KeyCode>>, mut time: ResMut<Time<Virtual>>) {
|
||||||
|
if input.just_pressed(KeyCode::Equal) {
|
||||||
|
time.set_relative_speed(2.0);
|
||||||
|
trace!("time speed set x2.0");
|
||||||
|
} else if input.just_pressed(KeyCode::Minus) {
|
||||||
|
time.set_relative_speed(0.5);
|
||||||
|
trace!("time speed set x0.5");
|
||||||
|
} else if input.just_pressed(KeyCode::Pause) {
|
||||||
|
if time.is_paused() {
|
||||||
|
time.unpause();
|
||||||
|
trace!("unpause game");
|
||||||
|
} else {
|
||||||
|
time.pause();
|
||||||
|
trace!("pause game");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Координатная сетка
|
/// Координатная сетка
|
||||||
#[derive(Component)]
|
#[derive(Component)]
|
||||||
pub struct Grid;
|
pub struct Grid;
|
||||||
|
|||||||
@@ -21,9 +21,13 @@ fn main() {
|
|||||||
// .add_systems(PostStartup, snake_game::debug::print_all_entities)
|
// .add_systems(PostStartup, snake_game::debug::print_all_entities)
|
||||||
.add_systems(Update, (head_rotation,))
|
.add_systems(Update, (head_rotation,))
|
||||||
.add_systems(FixedUpdate, (moving,))
|
.add_systems(FixedUpdate, (moving,))
|
||||||
// .add_systems(
|
.add_systems(
|
||||||
// PostUpdate,
|
PostUpdate,
|
||||||
// snake_game::debug::print_all_entities_by_press_enter,
|
(
|
||||||
// )
|
//
|
||||||
|
snake_game::debug::print_all_entities_by_press_enter,
|
||||||
|
snake_game::debug::time_speed,
|
||||||
|
),
|
||||||
|
)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user