food next delta bool

This commit is contained in:
ethan merchant 2024-11-25 23:45:39 -05:00
parent 12290f6c4a
commit f969d8382e
2 changed files with 6 additions and 4 deletions

View file

@ -151,8 +151,7 @@ static class Arts
// snake // snake
float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f; float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f;
bool food_next = !Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food; if (!Mono.menu && !Mono.food_next.state)
if (!Mono.menu && !food_next)
{ {
meshes["Tongue"].Draw( meshes["Tongue"].Draw(
mat_mono, mat_mono,
@ -167,7 +166,7 @@ static class Arts
string face = "Face0Default"; string face = "Face0Default";
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face; face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
face = Mono.in_box.delta != 0 ? "Face3Bump" : face; face = Mono.in_box.delta != 0 ? "Face3Bump" : face;
face = food_next ? "Face1Eat" : face; face = Mono.food_next.state ? "Face1Eat" : face;
meshes[face].Draw( meshes[face].Draw(
mat_mono, mat_mono,
Matrix.TRS( Matrix.TRS(
@ -238,7 +237,7 @@ static class Arts
} }
// food // food
if (!food_next) if (!Mono.food_next.state)
{ {
food_ori *= Quat.FromAngles( food_ori *= Quat.FromAngles(
90 * Time.Stepf, 90 * Time.Stepf,

View file

@ -42,6 +42,7 @@ static class Mono
public static XYZi food = new(0, 0, 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 int eaten = 0;
public static DeltaBool eaten_latch = new(false); public static DeltaBool eaten_latch = new(false);
public static DeltaBool food_next = new(false);
public static double eat_timestamp = 0.0; public static double eat_timestamp = 0.0;
public enum BoxMode public enum BoxMode
@ -127,6 +128,8 @@ static class Mono
{ {
snake_dir = Rig.new_dir; snake_dir = Rig.new_dir;
} }
food_next.Step(!Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food);
} }
public static void Step() public static void Step()