private void SetApples() { for (int i = 0; i < ammountOfApples; i++) { Apple.AddNewApple(i * 10, i * 10); } /*apples.Add(new Apple(16, 64)); * apples.Add(new Apple(16, 112)); * apples.Add(new Apple(128, 112)); * apples.Add(new Apple(80, 80)); * apples.Add(new Apple(128, 64));*/ }
public override void Move() { int x = X; int y = Y; switch (currentDirection) { case direction.Down: ++y; break; case direction.Right: ++x; break; case direction.Up: --y; break; case direction.Left: --x; break; } switch (Collision(x, y)) { case collisionType.Apple: X = x; Y = y; GameModel.Score++; Apple tempApple = FindItemIn(GameModel.apples, X, Y, 1); GameModel.apples.Remove(tempApple); Apple.AddNewApple(tempApple.X, tempApple.Y); break; case collisionType.Wall: break; case collisionType.Tank: GameModel.EndTheGame(); break; case collisionType.None: X = x; Y = y; break; } kolobokView.ChangeImage(currentDirection); }