Compare commits
7 commits
60436a18d0
...
218d5b40f7
Author | SHA1 | Date | |
---|---|---|---|
218d5b40f7 | |||
b3dc63f154 | |||
fc082d293b | |||
7e63215827 | |||
f969d8382e | |||
12290f6c4a | |||
62e446c175 |
6 changed files with 53 additions and 33 deletions
BIN
Assets/sfx/maw.mp3
(Stored with Git LFS)
Normal file
BIN
Assets/sfx/maw.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -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="46"
|
android:versionCode="48"
|
||||||
android:versionName="1.50"
|
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" />
|
||||||
|
|
|
@ -71,6 +71,8 @@ todo
|
||||||
start music on egg eat
|
start music on egg eat
|
||||||
to keep prior tutorial phase focused and a strong indication that auto move has kicked in
|
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
|
||||||
|
|
28
src/Arts.cs
28
src/Arts.cs
|
@ -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,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)
|
if (Mono.eaten == 0)
|
||||||
{
|
{
|
||||||
// starting egg
|
// starting egg
|
||||||
|
bool in_snake = Mono.s_array[new XYZi(0, 0, 0)] > -1;
|
||||||
meshes["Egg"].Draw(
|
meshes["Egg"].Draw(
|
||||||
mat_mono,
|
mat_mono,
|
||||||
Matrix.TRS(
|
Matrix.TRS(
|
||||||
Vec3.Zero,
|
Vec3.Zero,
|
||||||
Quat.Identity,
|
in_snake ? Quat.Identity : food_ori,
|
||||||
Mono.s_array[new XYZi(0, 0, 0)] > -1 ? 1 : 0.5f
|
in_snake ? 1 : 0.5f
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// food
|
// food
|
||||||
if (!food_next)
|
|
||||||
{
|
|
||||||
food_ori *= Quat.FromAngles(
|
|
||||||
90 * Time.Stepf,
|
|
||||||
30 * Time.Stepf,
|
|
||||||
10 * Time.Stepf
|
|
||||||
);
|
|
||||||
}
|
|
||||||
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;
|
||||||
|
|
48
src/Mono.cs
48
src/Mono.cs
|
@ -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,27 +170,30 @@ static class Mono
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snake_len == snake.Length)
|
if (eaten_latch.delta != +1)
|
||||||
{
|
{
|
||||||
// win condition
|
if (snake_len == snake.Length)
|
||||||
Log.Info("full snake");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (grow_buffer > 0)
|
|
||||||
{
|
{
|
||||||
snake_len++;
|
// win condition
|
||||||
grow_buffer--;
|
Log.Info("full snake");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (grow_buffer > 0)
|
||||||
|
{
|
||||||
|
snake_len++;
|
||||||
|
grow_buffer--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// slither
|
// slither
|
||||||
for (int i = snake.Length - 1; i > 0; i--)
|
for (int i = snake.Length - 1; i > 0; i--)
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue