From 46a0b2ded7ac826764dc3146c04115fbfd3a18c8 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Mon, 25 Nov 2024 13:51:45 -0500 Subject: [PATCH] egg is first food! --- src/Arts.cs | 56 ++++++++++++++++++++++++++++------------------------- src/Mono.cs | 2 +- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/Arts.cs b/src/Arts.cs index 84c440b..15a9bda 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -205,16 +205,6 @@ static class Arts ); } - // starting egg - meshes["Egg"].Draw( - mat_mono, - Matrix.TRS( - Vec3.Zero, - Quat.Identity, - 1 - ) - ); - // holes foreach (KeyValuePair hole in Mono.holes) { @@ -244,28 +234,42 @@ static class Arts ); } - - // food - if (!food_next) + if (Mono.eaten == 0) { - food_ori *= Quat.FromAngles( - 90 * Time.Stepf, - 30 * Time.Stepf, - 10 * Time.Stepf - ); - } - if (!Mono.eaten_latch.state) - { - float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1; - meshes["Food"].Draw( + // starting egg + meshes["Egg"].Draw( mat_mono, Matrix.TRS( - Mono.food.ToVec3, - food_ori, - food_t + Vec3.Zero, + Quat.Identity, + Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f ) ); } + else + { + // food + if (!food_next) + { + food_ori *= Quat.FromAngles( + 90 * Time.Stepf, + 30 * Time.Stepf, + 10 * Time.Stepf + ); + } + if (!Mono.eaten_latch.state) + { + float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1; + meshes["Food"].Draw( + mat_mono, + Matrix.TRS( + Mono.food.ToVec3, + food_ori, + food_t + ) + ); + } + } // particles Particle[] particles = VFX.particles; diff --git a/src/Mono.cs b/src/Mono.cs index a195efb..b19d987 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -39,7 +39,7 @@ 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(0, -1, 0); // [!] start random to keep new game fresh? + public static XYZi food = new(0, 0, 0); // [!] start random to keep new game fresh? public static int eaten = 0; public static DeltaBool eaten_latch = new(false); public static double eat_timestamp = 0.0;