private void CheckCollision() { if (worm.IsIntersected(wall.body) || worm.IsIntersected(worm.body)) { gameOver = true; Console.Clear(); Console.SetCursorPosition(15, 20); Console.Write("Game Over!"); } else if (worm.IsIntersected(food.body)) { //player.score.Score += 10; scoreLevel.Score += 25; player.Score = scoreLevel.Score; if (scoreLevel.Score == 50) { wall.Clear(); LevelNumber = 1; scoreLevel.Level = 2; wall.Draw(); } else if (scoreLevel.Score == 100) { wall.Clear(); LevelNumber = 2; scoreLevel.Level = 3; wall = new Wall('#', LevelNumber); wall.Draw(); } worm.Eat(food.body); food.GenerateLocation(worm.body, wall.body); } }
public void CheckCollision() { if (worm.IsIntersected(wall.body) || worm.CheckWall()) { timer.Enabled = false; Console.Clear(); Console.SetCursorPosition(15, 20); Console.Write("Game over!"); } else if (worm.IsIntersected(food.body)) { score++; if (score == 2) { degree++; } if (score == 5) { degree++; } Console.SetCursorPosition(41, 1); Console.WriteLine("Your score: " + score); Console.SetCursorPosition(41, 2); Console.WriteLine("Level: " + degree); worm.Eat(food.body); Thread.Sleep(200 - score); food.GenerateLocation(worm.body, wall.body); food.Draw(); } }
public void MoveSnake() { while (anal) { worm.Clear(); worm.Move(); worm.Draw(); ShowStatusBar(worm.body.Count.ToString()); //worm.Draw(); //CheckCollision(); if (worm.IsIntersected(wall.body)) { Console.Clear(); Console.SetCursorPosition(15, 20); Console.Write("Game over!"); anal = false; } if (worm.IsIntersected(food.body)) { anal = true; worm.Eat(food.body); food.GenerateLocation(worm.body, wall.body); food.Draw(); } else if (worm.snakegavno(worm.body)) { Console.Clear(); Console.SetCursorPosition(15, 20); Console.Write("Game over!"); anal = false; } if ((Convert.ToInt32(worm.body.Count.ToString()) >= 1 && (Convert.ToInt32(worm.body.Count.ToString()) <= 3))) { Thread.Sleep(150); } else if ((Convert.ToInt32(worm.body.Count.ToString()) >= 4 && (Convert.ToInt32(worm.body.Count.ToString()) <= 7))) { Thread.Sleep(100); } else if ((Convert.ToInt32(worm.body.Count.ToString()) >= 8 && (Convert.ToInt32(worm.body.Count.ToString()) <= 10))) { Thread.Sleep(50); } else if ((Convert.ToInt32(worm.body.Count.ToString()) >= 11)) { Thread.Sleep(10); } } }
private void CheckCollision() { if (worm.IsIntersected(wall.body)) { gameOver = true; Console.Clear(); Console.SetCursorPosition(10, 20); Console.Write("Game over!"); } else if (worm.IsIntersected(food.body)) { worm.Eat(food.body); food.GenerateLocation(); } }
private void CheckCollision() { if (worm.IsIntersected(wall.body)) { timer.Enabled = false; Console.Clear(); Console.SetCursorPosition(10, 20); Console.Write("Game over!"); } else if (worm.IsIntersected(food.body)) { worm.Eat(food.body); food.GenerateLocation(worm.body, wall.body); food.Draw(); } }
private void CheckCollision() { if (worm.IsIntersected2()) /////////WORM BODY COLLISION { Butter.gameOver = true; gameover(); } else if (worm.IsIntersected(wall.body))/////////WORM WALL COLLISION { Butter.gameOver = true; gameover(); } else if (worm.IsIntersected(food.body)) { worm.Eat(food.body); food.GenerateLocation(); food.Draw(); } }