> Launch using the Green Flag. > Play using W-A-S-D or Arrow Keys > Eat apples > Avoid walls and self
Each body segment keeps internally track of the size of the snake at the moment of spawning. Whenever the head moves 1 tile, it sends a signal to all body segments and they all decrease their "timer" variable. Whenever the head eats an apple, it sends a "grow" signal, which increases the "timer" of all segments. Last segment has timer value "1" and this causes the shrinking animation. Newest segment grows from 40% size, which fixes the problem of the head being smaller than the body segment. Checking for wall hits is accomplished by detecting wall color. Checking for eating an apple is accomplished through classic collision sense.