optimize constant

This commit is contained in:
Baipyrus 2022-05-17 13:08:10 +02:00
parent 79fa7898b7
commit ee580128a5

View File

@ -5,7 +5,7 @@ namespace FlappyBird {
class Program {
// Constants
static string scoreText = "Your score is: ";
static float gravity = 0.15f;
static float gravity = 0.175f;
static float jumpVel = 1.75f;
static int pipeInterval = 60;
static int spaceHeight = 8;
@ -75,7 +75,7 @@ namespace FlappyBird {
if (frameCount % pipeInterval == 0) {
Random rng = new Random();
int pipeX = board.GetLength(0)-2;
int spaceY = rng.Next(1,board.GetLength(1)-2-spaceHeight);
int spaceY = rng.Next(2,board.GetLength(1)-6-spaceHeight);
for (int j = 1; j < board.GetLength(1)-1; j++)
if (j < spaceY || j > spaceY+spaceHeight)
board[pipeX, j] = '$';