don't move if next pos is not in or around box
This commit is contained in:
parent
c1f0bcc956
commit
5b0a096502
1 changed files with 2 additions and 8 deletions
10
src/Mono.cs
10
src/Mono.cs
|
@ -127,14 +127,8 @@ static class Mono
|
|||
return;
|
||||
}
|
||||
|
||||
XYZi next_pos = snake[0] + snake_dir;
|
||||
XYZi inset_pos = new(
|
||||
next_pos.x - Maths.sign(next_pos.x),
|
||||
next_pos.y - Maths.sign(next_pos.y),
|
||||
next_pos.z - Maths.sign(next_pos.z)
|
||||
);
|
||||
bool around_box = s_array.InRange(inset_pos);
|
||||
if (!around_box)
|
||||
bool in_or_around_box = s_array.InRange(snake[0] + snake_dir);
|
||||
if (!in_or_around_box)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue