Esempio n. 1
0
 public void ClearMap()
 {
     Obstacles.Clear();
     PowerUps = new PowerUpCollection();
     Scores.Clear();
     Snakes.Clear();
 }
Esempio n. 2
0
 public void EndGameCheck()
 {
     if (Snakes.Where(x => x.GameOver == true).ToList().Count > 0)
     {
         this.Exit = true;
     }
 }
Esempio n. 3
0
        public void Move(Snakes Python)
        {
            switch (Python.direct)
            {
            case Snakes.Directions.Up:
            {
                Python.prev_segment = new Rectangle(Python.snake[0].X, Python.snake[0].Y - 20, 20, 20);
            }
            break;

            case Snakes.Directions.Down:
            {
                Python.prev_segment = new Rectangle(Python.snake[0].X, Python.snake[0].Y + 20, 20, 20);
            }
            break;

            case Snakes.Directions.Left:
            {
                Python.prev_segment = new Rectangle(Python.snake[0].X - 20, Python.snake[0].Y, 20, 20);
            }
            break;

            case Snakes.Directions.Right:
            {
                Python.prev_segment = new Rectangle(Python.snake[0].X + 20, Python.snake[0].Y, 20, 20);
            }
            break;
            }
            for (int i = 0; i < Python.snake.Count; i++)
            {
                Python.segment      = Python.snake[i];
                Python.snake[i]     = Python.prev_segment;
                Python.prev_segment = Python.segment;
            }
        }
Esempio n. 4
0
 public Form1()
 {
     InitializeComponent();
     F               = new Field(PB_Field, new Rectangle(0, 0, PB_Field.Width, PB_Field.Height));
     Python          = new Snakes();
     timer1.Interval = 200;
     timer1.Enabled  = true;
 }
Esempio n. 5
0
 public void IsEat(Snakes Python, Field F)
 {
     if (Math.Abs(Python.snake[0].X - F.food.X) <= 20 && Math.Abs(Python.snake[0].Y - F.food.Y) <= 20)
     {
         F.FoodExist = false;
         Python.snake.Add(new Rectangle(Python.snake[Python.snake.Count - 1].X, Python.snake[Python.snake.Count - 1].Y, 20, 20));
         complexity = false;
     }
 }
Esempio n. 6
0
 public TheGame(int numberOfPlayers, int numberOfSnacks)
 {
     NumberOfPlayers = numberOfPlayers;
     for (int i = 0; i < numberOfPlayers; i++)
     {
         Snakes.Add(new Snake(40, 20, i));
     }
     for (int i = 0; i < numberOfSnacks; i++)
     {
         Snacks.Add(new Snack());
     }
 }
Esempio n. 7
0
 public void Complexity(Snakes Python, Timer timer1)
 {
     if (Python.EatYourselve())
     {
         Python.snake.RemoveRange(Python.snake.Count - Python.snake.Count / 3, Python.snake.Count / 3);
     }
     if (Python.snake.Count % 5 == 0 && timer1.Interval > 50 && !complexity)
     {
         timer1.Interval -= 20;
         complexity       = true;
     }
 }