Example #1
0
        public void Run()
        {
            timer.Elapsed += Timer_Elapsed;
            timer.Start();

            food.GenerateLocation(worm.body, wall.body);
            wall.Draw();
            food.Draw();
        }
Example #2
0
        public void Run(string ass)
        {
            Thread thread = new Thread(MoveSnake);

            thread.Start();

            project(ass);
            food.GenerateLocation(worm.body, wall.body);

            wall.Draw();
            food.Draw();
        }
Example #3
0
        public void Run()
        {
            timer.Elapsed += Timer_Elapsed;
            timer.Start();

            wall = new Wall('#', LevelNumber, c);
            wall.Draw();
            food.GenerateLocation(worm.body, wall.body);
            food.Draw();

            scoreLevel.Draw();
            //player.Draw();
        }
Example #4
0
        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);
            }
        }
Example #5
0
 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();
     }
 }
Example #6
0
 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();
     }
 }