Iv'e been trying to make a snake ai with C2. I saw that gif where the snake ate all the food and ended up filling the whole screen with itself and thought of replicating it.
I'm having trouble trying to make the snake avoid running into it's own tail.
I can avoid this if the snake is directly facing a tail segment with the help of line of sight behavior but not when the snake is right next to its own tail not facing it's tail segment.
I have conditions where 'if food.X greater than snake.X => move right' and so on for all directions for the snake to move automatically. The tail is a square segment which is spawned when 1 food is eaten
(Take example where the snake is moving up/down and has to move right to get it's food)
The problem is avoiding the snake from moving right if it has a part of it's tail to it's immediate right, and only move if it's clear.
If i put a condition 'check if tail is snake.X+10' , the system checks for all the tail parts and even if one tail part is not snake.X+10 the condition lets the snake move even if another tail is snake.X+10.
Using picked instances makes the snake not move at all for some reason, i think it's cause if no tail meets the picked condition the condition to make the snake move is not met.
Can anyone help?