Проектная работа - WIP
This commit is contained in:
@@ -29,9 +29,17 @@ pub fn head_rotation(
|
||||
head.0 = new_direction;
|
||||
transform.rotation = new_direction.orientation();
|
||||
trace!("running {direction} at {cur_pos} {translation}: go {new_direction}");
|
||||
} else if input.just_pressed(KeyCode::ArrowUp) {
|
||||
let (mut transform, mut head, direction) = query.into_inner();
|
||||
let translation = transform.translation.clone();
|
||||
let cur_pos = Position::from(&*transform);
|
||||
head.0 = direction.clone();
|
||||
transform.rotation = direction.orientation();
|
||||
trace!("running {direction} at {cur_pos} {translation}: go {direction}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Общая механика движения
|
||||
fn moving(
|
||||
velocity: &f32,
|
||||
time: &Time<Fixed>,
|
||||
@@ -68,6 +76,7 @@ fn moving(
|
||||
}
|
||||
}
|
||||
|
||||
/// Система движения головы змеи
|
||||
pub fn head_moving(
|
||||
query: Query<(&mut Transform, &mut Direction, &Velocity, &Head, Entity)>,
|
||||
time: Res<Time<Fixed>>,
|
||||
@@ -86,6 +95,7 @@ pub fn head_moving(
|
||||
}
|
||||
}
|
||||
|
||||
/// Система движения тела змеи
|
||||
pub fn snake_moving(
|
||||
query: Query<(&mut Transform, &mut Direction, &Velocity, Entity), (With<Tail>, Without<Head>)>,
|
||||
time: Res<Time<Fixed>>,
|
||||
|
||||
Reference in New Issue
Block a user