Проектная работа - WIP

This commit is contained in:
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -20,9 +20,10 @@ pub fn head_rotation(
new_direction.rotate_left();
if !snake_path.push(dst_pos, new_direction) {
trace!("try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath");
dst_pos.change(&direction);
dst_pos.shift(&direction);
if !snake_path.push(dst_pos, new_direction) {
trace!("try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath");
return;
}
}
transform.rotation = new_direction.orientation();
@@ -36,9 +37,10 @@ pub fn head_rotation(
new_direction.rotate_right();
if !snake_path.push(dst_pos, new_direction) {
trace!("try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath");
dst_pos.change(&direction);
dst_pos.shift(&direction);
if !snake_path.push(dst_pos, new_direction) {
trace!("try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath");
return;
}
}
transform.rotation = new_direction.orientation();