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 <manifest
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dofdev.snake" package="com.dofdev.snake"
android:versionCode="45" android:versionCode="48"
android:versionName="1.49" android:versionName="1.53"
android:installLocation="auto" android:installLocation="auto"
> >
<uses-sdk android:minSdkVersion="29" android:targetSdkVersion="32" /> <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 fun to play daily for a couple weeks or so
playable with a half engaging vid or conversation in the background 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 make depth easier to judge
pseudo light source is coming from your face (maybe at a diagonal *higher up* angler fish) pseudo light source is coming from your face (maybe at a diagonal *higher up* angler fish)
benchmark benchmark
need to be able to play without moving/turning the box 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*) my tempo (zen mode *after initial release*)
on l_con tap (a) btn to step, and repeatedly to set tempo 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 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( Lines.Add(
box_m4 * V.XYZ(0, Mono.SD_Y - 0.5f, 0), 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), 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 1.0f * U.mm
); );
Lines.Add( 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, -box_head_dist),
Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0), Rig.head.position + Rig.head.orientation * V.XYZ(0, 6 * U.cm, 0),
Color.White, Color.Hex(0x808080FF).ToLinear(),
1.0f * U.mm 1.0f * U.mm
); );
} }
@ -122,7 +122,7 @@ static class Arts
V.XYZ(-1.333f, 0, Mono.SD_Z - 0.5f + 0.1f), V.XYZ(-1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0) Quat.FromAngles(90, 0, 0)
), ),
Color.Hex(0x524B67FF) Color.Hex(0x928CA7FF).ToLinear()
); );
meshes["uiPlay"].Draw( meshes["uiPlay"].Draw(
mat_unlit, mat_unlit,
@ -130,7 +130,7 @@ static class Arts
V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f), V.XYZ(0, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0) Quat.FromAngles(90, 0, 0)
), ),
Color.Hex(0x080808FF) Color.Hex(0x333333FF).ToLinear()
); );
meshes["uiConfig"].Draw( meshes["uiConfig"].Draw(
mat_unlit, mat_unlit,
@ -138,7 +138,7 @@ static class Arts
V.XYZ(+1.333f, 0, Mono.SD_Z - 0.5f + 0.1f), V.XYZ(+1.333f, 0, Mono.SD_Z - 0.5f + 0.1f),
Quat.FromAngles(90, 0, 0) Quat.FromAngles(90, 0, 0)
), ),
Color.Hex(0x524B67FF) Color.Hex(0x928CA7FF).ToLinear()
); );
meshes["uiCursor"].Draw( meshes["uiCursor"].Draw(
mat_unlit, mat_unlit,
@ -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(
@ -237,22 +236,8 @@ static class Arts
); );
} }
if (Mono.eaten == 0)
{
// starting egg
meshes["Egg"].Draw(
mat_mono,
Matrix.TRS(
Vec3.Zero,
Quat.Identity,
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
)
);
}
else
{
// food // food
if (!food_next) if (!Mono.food_next.state)
{ {
food_ori *= Quat.FromAngles( food_ori *= Quat.FromAngles(
90 * Time.Stepf, 90 * Time.Stepf,
@ -260,6 +245,23 @@ static class Arts
10 * 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
)
);
}
else
{
// food
if (!Mono.eaten_latch.state) if (!Mono.eaten_latch.state)
{ {
float food_t = Mono.eaten_latch.delta == -1 ? Maths.smooth_stop((float)Mono.step_t) : 1; 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 bool menu = true;
public static Pose box_pose = new(0, -3 * U.cm, -10 * U.cm); 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 static float box_scale = 1.333f * U.cm;
public const int SD_X = 3, SD_Y = 2, SD_Z = 3; public const int SD_X = 3, SD_Y = 2, SD_Z = 3;
public static SpatialArray<int> 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 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
@ -111,11 +113,12 @@ static class Mono
break; break;
case BoxMode.Hold: case BoxMode.Hold:
box_pose.position = Rig.r_con_stick.position; 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; } if (Rig.btn_grip.delta == -1) { box_mode = in_cone.state ? BoxMode.Mount : BoxMode.Float; }
break; break;
case BoxMode.Mount: case BoxMode.Mount:
// orbital_view // 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; } if (pickup) { box_mode = BoxMode.Hold; }
break; break;
} }
@ -123,10 +126,16 @@ static class Mono
XYZi next_pos = snake[0] + Rig.new_dir; XYZi next_pos = snake[0] + Rig.new_dir;
bool neck_break = next_pos == snake[1]; bool neck_break = next_pos == snake[1];
if (!neck_break) if (!neck_break && !food_next.state)
{ {
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);
if (food_next.delta == +1)
{
SFX.maw.PlayBox(Mono.snake[0]);
}
} }
public static void Step() public static void Step()
@ -161,6 +170,8 @@ static class Mono
return; return;
} }
if (eaten_latch.delta != +1)
{
if (snake_len == snake.Length) if (snake_len == snake.Length)
{ {
// win condition // win condition
@ -182,6 +193,7 @@ static class Mono
snake[i] = snake[i - 1]; snake[i] = snake[i - 1];
} }
snake[0] += snake_dir; snake[0] += snake_dir;
}
in_box.Step(box_space.InRange(snake[0])); in_box.Step(box_space.InRange(snake[0]));
if (in_box.delta != 0) // 1 just in -1 just out 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 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 crisp_nom = Sound.FromFile("sfx/crisp_nom.mp3");
public static Sound punch_through = Sound.FromFile("sfx/punch_through.mp3"); public static Sound punch_through = Sound.FromFile("sfx/punch_through.mp3");
} }