From 335cf3b8ac1d4474c9e19fc3265ac52325da2569 Mon Sep 17 00:00:00 2001 From: spatialfree Date: Fri, 8 Nov 2024 21:45:08 -0500 Subject: [PATCH] don't fall --- src/Arts.cs | 17 ++--------------- src/Mono.cs | 31 ------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/src/Arts.cs b/src/Arts.cs index 565f2b5..c0d7416 100644 --- a/src/Arts.cs +++ b/src/Arts.cs @@ -76,20 +76,13 @@ static class Arts } // snake - float fall_t = 0.0f; - if (Mono.snake_fall.state) - { - // if (Mono.snake_fall.delta == +1) // start falling - fall_t = 1.0f - (float)Mono.step_t; - } - Vec3 fall = V.XYZ(0, fall_t, 0); bool food_next = (Mono.snake[0] + Mono.snake_dir) == Mono.food; if (!food_next) { meshes["Tongue"].Draw( mat_mono, Matrix.TRS( - Mono.snake[0].ToVec3 + fall, + Mono.snake[0].ToVec3, Quat.LookDir(Rig.fullstick), V.XYZ(1, 1, 0.666f + Maths.smooth_stop((float)Mono.step_t) * 0.333f) ) @@ -138,12 +131,6 @@ static class Arts // food - float food_fall_t = 0.0f; - if (Mono.food_fall.state) - { - // if (Mono.food_fall.delta == +1) // start falling - food_fall_t = 1.0f - (float)Mono.step_t; - } if (!food_next) { food_ori *= Quat.FromAngles( @@ -155,7 +142,7 @@ static class Arts meshes["Food"].Draw( mat_mono, Matrix.TR( - Mono.food.ToVec3 + V.XYZ(0, food_fall_t, 0), + Mono.food.ToVec3, food_ori ) ); diff --git a/src/Mono.cs b/src/Mono.cs index 9f9336a..13a01fe 100644 --- a/src/Mono.cs +++ b/src/Mono.cs @@ -26,10 +26,8 @@ static class Mono public static int grow_buffer = 0; public static XYZi snake_dir = new(0, 0, 1); public static DeltaBool in_box = new(true); - public static DeltaBool snake_fall = new(false); public static Dictionary holes = new(); public static XYZi food = new(2, 0, 0); - public static DeltaBool food_fall = new(false); public static double eat_timestamp = 0.0; public static void Init() @@ -116,35 +114,6 @@ static class Mono snake[0] += snake_dir; } - // gravity - bool grounded = false; - for (int i = 0; i < snake_len; i++) - { - if (snake[i].y == -SD_Y) - { - grounded = true; - break; - } - } - snake_fall.Step(!grounded && holes.Count == 0); - if (snake_fall.state) - { - for (int i = 0; i < snake_len; i++) - { - snake[i] -= new XYZi(0, 1, 0); - } - } - - bool food_grounded = food.y == -SD_Y; - XYZi below_food = new XYZi(food.x, food.y - 1, food.z); - bool on_snake = s_array.InRange(below_food) && s_array[below_food] > -1; - food_fall.Step(!food_grounded && !on_snake); - if (food_fall.state) - { - food -= new XYZi(0, 1, 0); - } - - in_box.Step(s_array.InRange(snake[0])); if (in_box.delta != 0) // 1 just in -1 just out {