Проектная работа - WIP
This commit is contained in:
@@ -15,15 +15,20 @@ pub fn head_rotation(
|
||||
|
||||
let (mut transform, mut direction) = query.into_inner();
|
||||
|
||||
let mut append_snake_path = |transform: &Transform, direction: &Direction| {
|
||||
snake_path.push(&transform, direction.clone());
|
||||
trace!("append snake_path: {:?}", snake_path);
|
||||
};
|
||||
|
||||
if input.just_pressed(KeyCode::ArrowLeft) {
|
||||
transform.rotate_z(PI / 2.0);
|
||||
direction.rotate_left();
|
||||
snake_path.push(&transform, direction.clone());
|
||||
append_snake_path(&transform, &direction);
|
||||
}
|
||||
if input.just_pressed(KeyCode::ArrowRight) {
|
||||
transform.rotate_z(-PI / 2.0);
|
||||
direction.rotate_right();
|
||||
snake_path.push(&transform, direction.clone());
|
||||
append_snake_path(&transform, &direction);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user