From 3feae88098dc859150b667352c09d63c7935df50 Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Thu, 13 Oct 2022 15:28:25 +0200 Subject: [PATCH] renaming --- Program.cs => FlappyBird.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) rename Program.cs => FlappyBird.cs (91%) diff --git a/Program.cs b/FlappyBird.cs similarity index 91% rename from Program.cs rename to FlappyBird.cs index d8b5030..17ee17c 100644 --- a/Program.cs +++ b/FlappyBird.cs @@ -5,22 +5,25 @@ namespace FlappyBird { class Program { // Constants static string scoreText = "Your score is: "; - static float gravity = 0.175f; - static float jumpVel = 1.75f; + static float factor = 32/1.4f; static int pipeInterval = 60; - static int spaceHeight = 8; + static int height = 15; + static int width = 30; static int FPS = 60; // Game variables static char[,] board; - static int birdX = 5, score = 0; - static float birdY = 20f, velY = 0f; + static int spaceHeight = height/5; + static float jumpVel = height/factor; static bool gameOver, startOver = true; + static int birdX = width/16+1, score = 0; + static float birdY = height/2f, velY = 0f; + static float gravity = height/(factor*10); static void Main() { while (startOver) { gameOver = false; - board = new char[82, 37]; + board = new char[width + 2, height + 2]; // Fill the 'board' Array with blank spaces for (int i = 0; i < board.GetLength(0); i++) @@ -40,6 +43,8 @@ namespace FlappyBird { for (int j = 0; j < board.GetLength(1); j++) { for (int i = 0; i < board.GetLength(0); i++) { string pipeCon = (i < board.GetLength(0)-1) ? "|" : ""; + bool yC = j%(board.GetLength(1)-1)==0; + pipeCon = (yC && pipeCon != "") ? "#" : pipeCon; Console.Write($"{board[i, j]}{pipeCon}"); } Console.WriteLine(); @@ -145,7 +150,7 @@ namespace FlappyBird { if (uin.ToLower() == "n") startOver = false; else { - birdY = 20f; + birdY = height/2f; velY = 0f; score = 0; }