diff --git a/src/Mono.cs b/src/Mono.cs index be95363..bc2de6e 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -26,7 +26,8 @@ static class Mono public static XYZi snake_dir = new(0, 0, 1); public static DeltaBool in_box = new(true); public static Dictionary holes = new(); - public static XYZi food = new(2, 0, 0); + public static XYZi food = new(2, 0, 0); // [!] start random to keep new game fresh? + public static bool eaten_latch = false; public static double eat_timestamp = 0.0; public enum BoxMode @@ -180,13 +181,26 @@ static class Mono } // eat - if (food == snake[0]) + if (!eaten_latch) { - eat_timestamp = Time.Total; - grow_buffer += 3; + if (food == snake[0]) + { + eaten_latch = true; + eat_timestamp = Time.Total; + grow_buffer += 3; - Feed(); - SFX.crisp_nom.PlayBox(snake[0]); + SFX.crisp_nom.PlayBox(snake[0]); + + // move food out of play + food.y = 5; + } + } else { + (bool viable, XYZi cell) = Feed(); + if (viable) + { + food = cell; + eaten_latch = false; + } } }