From ca2c94a830aea6d9eeefed109a58b224b46b927b Mon Sep 17 00:00:00 2001 From: Alexander Baranov Date: Sat, 6 Jun 2026 09:49:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=BE=D0=B5=D0=BA=D1=82=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20-=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snake-game/src/gameplay.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/snake-game/src/gameplay.rs b/snake-game/src/gameplay.rs index aad4ed2..f8fba6b 100644 --- a/snake-game/src/gameplay.rs +++ b/snake-game/src/gameplay.rs @@ -19,15 +19,15 @@ pub fn head_rotation( let mut new_direction = direction.clone(); new_direction.rotate_left(); if !snake_path.push(dst_pos, new_direction) { - trace!("try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); + trace!("head_rotation - try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); dst_pos.shift(&direction); if !snake_path.push(dst_pos, new_direction) { - trace!("try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); + trace!("head_rotation - try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); return; } } transform.rotation = new_direction.orientation(); - trace!("running {direction} at {cur_pos} {translation}: go {new_direction} on {dst_pos}"); + trace!("head_rotation - running {direction} at {cur_pos} {translation}: go {new_direction} on {dst_pos}"); } else if input.just_pressed(KeyCode::ArrowRight) { let (mut transform, direction) = query.into_inner(); let translation = transform.translation.clone(); @@ -36,15 +36,15 @@ pub fn head_rotation( let mut new_direction = direction.clone(); new_direction.rotate_right(); if !snake_path.push(dst_pos, new_direction) { - trace!("try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); + trace!("head_rotation - try 1 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); dst_pos.shift(&direction); if !snake_path.push(dst_pos, new_direction) { - trace!("try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); + trace!("head_rotation - try 2 failed: cannot push [{dst_pos} => {new_direction}] into SnakePath"); return; } } transform.rotation = new_direction.orientation(); - trace!("running {direction} at {cur_pos} {translation}: go {new_direction} on {dst_pos}"); + trace!("head_rotation - running {direction} at {cur_pos} {translation}: go {new_direction} on {dst_pos}"); } } @@ -70,7 +70,7 @@ pub fn snake_moving( let delta = second.1.abs(); let pos = Position::from(&*transform); if let Some(dir) = snake_path.peek(&pos) { - trace!("set new direction for {entity} in {pos} --> {dir}"); + trace!("snake_moving - set new direction for {entity} in {pos} --> {dir}"); *direction = dir.clone(); } let src = direction.get_coord(&*transform);