public static void StartGame() { Reader.GetHighScore(fullPath); score = 0; snakeOne = new Object.Snake(25, 15, width, heigth); snakeTwo = new Object.Snake(15, 5, width, heigth); appleOne = new Object.Apple(width, heigth, 1); appleTwo = new Object.Apple(width, heigth, 10); gameOverStatus = 0; }
static public void GamePlayer2(Object.Snake snake) { KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.W) & (snake.Direction != 2)) { snake.Direction = 0; } if ((keyState.IsKeyDown(Keys.D)) & (snake.Direction != 3)) { snake.Direction = 1; } if ((keyState.IsKeyDown(Keys.S)) & (snake.Direction != 0)) { snake.Direction = 2; } if ((keyState.IsKeyDown(Keys.A)) & (snake.Direction != 1)) { snake.Direction = 3; } }
static public void GamePlayer1(Object.Snake snake) { KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Up) & (snake.Direction != 2)) { snake.Direction = 0; } if ((keyState.IsKeyDown(Keys.Right)) & (snake.Direction != 3)) { snake.Direction = 1; } if ((keyState.IsKeyDown(Keys.Down)) & (snake.Direction != 0)) { snake.Direction = 2; } if ((keyState.IsKeyDown(Keys.Left)) & (snake.Direction != 1)) { snake.Direction = 3; } }