Compare commits

...

10 commits

6 changed files with 61 additions and 41 deletions

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

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="45"
android:versionName="1.49"
android:versionCode="48"
android:versionName="1.53"
android:installLocation="auto"
>
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" />

View file

@ -62,15 +62,17 @@ todo
fun to play daily for a couple weeks or so
playable with a half engaging vid or conversation in the background
user prompt
for start and any other times we need to communicate simple instructions to the player
make depth easier to judge
pseudo light source is coming from your face (maybe at a diagonal *higher up* angler fish)
benchmark
need to be able to play without moving/turning the box
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

@ -91,13 +91,13 @@ static class Arts
Lines.Add(
box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0),
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
Color.White,
Color.Hex(0x808080FF).ToLinear(),
1.0f * U.mm
);
Lines.Add(
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, -box_head_dist),
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0),
Color.White,
Color.Hex(0x808080FF).ToLinear(),
1.0f * U.mm
);
}
@ -122,7 +122,7 @@ static class Arts
V.XYZ(-1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0)
),
Color.Hex(0x524B67FF)
Color.Hex(0x928CA7FF).ToLinear()
);
meshes["uiPlay"].Draw(
mat_unlit,
@ -130,7 +130,7 @@ static class Arts
V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0)
),
Color.Hex(0x080808FF)
Color.Hex(0x333333FF).ToLinear()
);
meshes["uiConfig"].Draw(
mat_unlit,
@ -138,7 +138,7 @@ static class Arts
V.XYZ(+1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0)
),
Color.Hex(0x524B67FF)
Color.Hex(0x928CA7FF).ToLinear()
);
meshes["uiCursor"].Draw(
mat_unlit,
@ -151,8 +151,7 @@ static class Arts
// snake
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 && !food_next)
if (!Mono.menu && !Mono.food_next.state)
{
meshes["Tongue"].Draw(
mat_mono,
@ -167,7 +166,7 @@ static class Arts
string face = "Face0Default";
face = Mono.grow_buffer > 0 ? "Face2Eaten" : face;
face = Mono.in_box.delta != 0 ? "Face3Bump" : face;
face = food_next ? "Face1Eat" : face;
face = Mono.food_next.state ? "Face1Eat" : face;
meshes[face].Draw(
mat_mono,
Matrix.TRS(
@ -237,29 +236,32 @@ 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,
Quat.Identity,
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
in_snake ? Quat.Identity : food_ori,
in_snake ? 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,6 +15,7 @@ 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>
@ -42,6 +43,7 @@ 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
@ -111,11 +113,12 @@ 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, -32 * U.cm);
box_pose.position = Rig.head.position + Rig.head.orientation * V.XYZ(0, -(SD_Y + 0.5f) * box_scale, -box_dist);
if (pickup) { box_mode = BoxMode.Hold; }
break;
}
@ -123,10 +126,16 @@ static class Mono
XYZi next_pos = snake[0] + Rig.new_dir;
bool neck_break = next_pos == snake[1];
if (!neck_break)
if (!neck_break && !food_next.state)
{
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()
@ -161,27 +170,30 @@ static class Mono
return;
}
if (snake_len == snake.Length)
if (eaten_latch.delta != +1)
{
// win condition
Log.Info("full snake");
return;
}
else
{
if (grow_buffer > 0)
if (snake_len == snake.Length)
{
snake_len++;
grow_buffer--;
// 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];
// slither
for (int i = snake.Length - 1; i > 0; i--)
{
snake[i] = snake[i - 1];
}
snake[0] += snake_dir;
}
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,6 +10,7 @@ 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");
}