headmove tail move deltabools

This commit is contained in:
ethan merchant 2024-11-08 23:20:38 -05:00
parent 41ae92a37e
commit 8167ab990b
2 changed files with 17 additions and 1 deletions

View file

@ -13,6 +13,11 @@ static class Arts
static Quat food_ori = Quat.Identity;
static XYZi last_headpos = new(0, 0, 0);
static DeltaBool headmove = new(false);
static XYZi last_tailpos = new(0, 0, 0);
static DeltaBool tailmove = new(false);
public static void Init()
{
foreach (ModelNode node in assets_model.Nodes)
@ -76,7 +81,7 @@ static class Arts
}
// snake
float snake_t = Maths.smooth_stop((float)Mono.step_t);
float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f;
bool food_next = (Mono.snake[0] + Mono.snake_dir) == Mono.food;
if (!food_next)
{
@ -181,4 +186,14 @@ static class Arts
// }
// }
}
public static void Step()
{
XYZi snake_head = Mono.snake[0];
XYZi snake_tail = Mono.snake[Mono.snake_len -1];
headmove.Step(snake_head != last_headpos);
tailmove.Step(snake_tail != last_tailpos);
last_headpos = snake_head;
last_tailpos = snake_tail;
}
}

View file

@ -52,6 +52,7 @@ class Program
Mono.step_time -= Mono.step_step;
Mono.Step();
Arts.Step();
}
Arts.Frame();