Compare commits

..

No commits in common. "218d5b40f7affc1d4d1cf255360f7e9dc3e1200c" and "60436a18d0db588a668b7116deb6a3a3343f41df" have entirely different histories.

6 changed files with 36 additions and 56 deletions

BIN
Assets/sfx/maw.mp3 (Stored with Git LFS)

Binary file not shown.

View file

@ -2,8 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.snake"
android:versionCode="48"
android:versionName="1.53"
android:versionCode="46"
android:versionName="1.50"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />

View file

@ -71,8 +71,6 @@ todo
start music on egg eat
to keep prior tutorial phase focused and a strong indication that auto move has kicked in
curved hanger
my tempo (zen mode *after initial release*)
on l_con tap (a) btn to step, and repeatedly to set tempo
once a tempo has been set you can stop tapping and you'll coast at that tempo

View file

@ -151,7 +151,8 @@ static class Arts
// snake
float snake_t = headmove.state ? Maths.u_clamp(Maths.smooth_stop((float)Mono.step_t) * 3.0f) : 1.0f;
if (!Mono.menu && !Mono.food_next.state)
bool food_next = !Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food;
if (!Mono.menu && !food_next)
{
meshes["Tongue"].Draw(
mat_mono,
@ -166,7 +167,7 @@ static class Arts
string face = "Face0Default";
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
face = Mono.in_box.delta != 0 ? "Face3Bump" : face;
face = Mono.food_next.state ? "Face1Eat" : face;
face = food_next ? "Face1Eat" : face;
meshes[face].Draw(
mat_mono,
Matrix.TRS(
@ -236,32 +237,29 @@ static class Arts
);
}
// food
if (!Mono.food_next.state)
{
food_ori *= Quat.FromAngles(
90 * Time.Stepf,
30 * Time.Stepf,
10 * Time.Stepf
);
}
if (Mono.eaten == 0)
{
// starting egg
bool in_snake = Mono.s_array[new XYZi(0, 0, 0)] > -1;
meshes["Egg"].Draw(
mat_mono,
Matrix.TRS(
Vec3.Zero,
in_snake ? Quat.Identity : food_ori,
in_snake ? 1 : 0.5f
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;

View file

@ -15,7 +15,6 @@ static class Mono
public static bool menu = true;
public static Pose box_pose = new(0, -3 * U.cm, -10 * U.cm);
public static float box_dist = 32 * U.cm;
public static float box_scale = 1.333f * U.cm;
public const int SD_X = 3, SD_Y = 2, SD_Z = 3;
public static SpatialArray<int>
@ -43,7 +42,6 @@ static class Mono
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 DeltaBool food_next = new(false);
public static double eat_timestamp = 0.0;
public enum BoxMode
@ -113,12 +111,11 @@ static class Mono
break;
case BoxMode.Hold:
box_pose.position = Rig.r_con_stick.position;
box_dist = Vec3.Distance(box_pose.position, Rig.head.position);
if (Rig.btn_grip.delta == -1) { box_mode = in_cone.state ? BoxMode.Mount : BoxMode.Float; }
break;
case BoxMode.Mount:
// orbital_view
box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -box_dist);
box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -32 * U.cm);
if (pickup) { box_mode = BoxMode.Hold; }
break;
}
@ -126,16 +123,10 @@ static class Mono
XYZi next_pos = snake[0] + Rig.new_dir;
bool neck_break = next_pos == snake[1];
if (!neck_break && !food_next.state)
if (!neck_break)
{
snake_dir = Rig.new_dir;
}
food_next.Step(!Mono.eaten_latch.state && (Mono.snake[0] + Mono.snake_dir) == Mono.food);
if (food_next.delta == +1)
{
SFX.maw.PlayBox(Mono.snake[0]);
}
}
public static void Step()
@ -170,30 +161,27 @@ static class Mono
return;
}
if (eaten_latch.delta != +1)
if (snake_len == snake.Length)
{
if (snake_len == snake.Length)
{
// win condition
Log.Info("full snake");
return;
}
else
{
if (grow_buffer > 0)
{
snake_len++;
grow_buffer--;
}
}
// slither
for (int i = snake.Length - 1; i > 0; i--)
{
snake[i] = snake[i - 1];
}
snake[0] += snake_dir;
// win condition
Log.Info("full snake");
return;
}
else
{
if (grow_buffer > 0)
{
snake_len++;
grow_buffer--;
}
}
// slither
for (int i = snake.Length - 1; i > 0; i--)
{
snake[i] = snake[i - 1];
}
snake[0] += snake_dir;
in_box.Step(box_space.InRange(snake[0]));
if (in_box.delta != 0) // 1 just in -1 just out

View file

@ -10,7 +10,6 @@ static class SFX
}
public static Sound click = Sound.FromFile("sfx/click.mp3");
public static Sound maw = Sound.FromFile("sfx/maw.mp3");
public static Sound crisp_nom = Sound.FromFile("sfx/crisp_nom.mp3");
public static Sound punch_through = Sound.FromFile("sfx/punch_through.mp3");
}