snake base length setting

This commit is contained in:
Baipyrus 2023-03-29 11:57:53 +02:00
parent e2ad89c25e
commit 4f10d60575

View File

@ -14,7 +14,7 @@ namespace RPI_Matrix {
private static List<string> gamepadListeners = new();
private static int selectionIndex, keypressFrame, frameCount;
private static bool hasSelected, isInGame, isTetris, isFlappy, isSnake;
private static bool selection = true, focusHeight, focusGravity, focusJump, isFocused;
private static bool selection = true, isFocused, focusHeight, focusGravity, focusJump, focusLength;
public static void Main(string[] args) {
// Connect to RGB LED Matrix
@ -148,12 +148,15 @@ namespace RPI_Matrix {
canvas.DrawText(font, 0, 72, col, $" ) Höhe {FlappyBird.FlappyBird.spaceHeight}");
canvas.DrawText(font, 0, 90, col, $" ) Gravitation {FlappyBird.FlappyBird.gravity}");
canvas.DrawText(font, 0, 108, col, $" ) Sprung Ges. {FlappyBird.FlappyBird.jumpVel}");
canvas.DrawText(font, 0, 144, col, " ) Zurück");
canvas.DrawText(font, 0, 126, col, "SnakeGame");
canvas.DrawText(font, 0, 144, col, $" ) Basis Länge {SnakeGame.SnakeGame.baseLength}");
canvas.DrawText(font, 0, 180, col, " ) Zurück");
// Cursor is a '#' at (0, 24 + i * 8) where i may be [0, 2]
int nx = debugIndex;
if (debugIndex >= 1) nx++;
if (debugIndex >= 4) nx++;
if (debugIndex >= 5) nx++;
canvas.DrawText(font, 0, 36 + nx * 18, col, "#");
canvas = matrix.SwapOnVsync(canvas);
@ -168,7 +171,7 @@ namespace RPI_Matrix {
debugIndex--;
break;
case ConsoleKey.DownArrow:
if (debugIndex < 1)
if (debugIndex < 5)
debugIndex++;
break;
case ConsoleKey.Enter:
@ -201,6 +204,11 @@ namespace RPI_Matrix {
isFocused = true;
break;
case 4:
// Go back to menu
focusLength = true;
isFocused = true;
break;
case 5:
// Go back to menu
debugMenu = false;
break;
@ -345,7 +353,9 @@ namespace RPI_Matrix {
FlappyBird.FlappyBird.spaceHeight -= 1;
else if (focusJump && FlappyBird.FlappyBird.jumpVel > 0)
FlappyBird.FlappyBird.jumpVel -= 0.01f;
else if (debugIndex < 4 && !isFocused)
else if (focusLength && SnakeGame.SnakeGame.baseLength > 0)
SnakeGame.SnakeGame.baseLength -= 1;
else if (debugIndex < 5 && !isFocused)
debugIndex++;
}
@ -372,6 +382,8 @@ namespace RPI_Matrix {
FlappyBird.FlappyBird.spaceHeight += 1;
else if (focusJump)
FlappyBird.FlappyBird.jumpVel += 0.01f;
else if (focusLength)
SnakeGame.SnakeGame.baseLength += 1;
else if (debugIndex > 0 && !isFocused)
debugIndex--;
}
@ -422,6 +434,7 @@ namespace RPI_Matrix {
Tetris.Tetris.placeDownBlock();
else if (!isSnake) {
focusGravity = false;
focusLength = false;
focusHeight = false;
focusJump = false;
isFocused = false;