public void ClearMap() { Obstacles.Clear(); PowerUps = new PowerUpCollection(); Scores.Clear(); Snakes.Clear(); }
public void EndGameCheck() { if (Snakes.Where(x => x.GameOver == true).ToList().Count > 0) { this.Exit = true; } }
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; } }
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; }
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; } }
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()); } }
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; } }