public override void resetBalls(int width,int height) { this.Balls = new List<Ball>(); //biggest ball ball = new Ball(30, 40, width, height, 40, Math.PI / 4); //Balls.Add(ball); //middle ball ball = new Ball(width - 115, 180, width, height, 32, 3 * Math.PI / 4); this.Balls.Add(ball); //small ball ball = new Ball(30, 220, width, height, 20, Math.PI / 4); // Balls.Add(ball); //smallest ball ball = new Ball(width - 115, 270, width, height, 8, 3 * Math.PI / 4); this.Balls.Add(ball); }
public void hitBallCheck(bool isShooting) { if (isShooting) { for (int i = 0; i < Balls.Count; i++) for (int j = 0; j < Shot.ShootingPoints.Count; j++) { if (!Balls[i].isHit) if (Balls[i].isHitBall(Shot.ShootingPoints[j])) { ticksCounter = 0; Balls[i].bubble = Resources.explosion; Balls[i].isHit = true; player.isShooting = false; Balls[i].dying = true; Balls[i].velocity = 0; break; } else { Balls[i].isHit = false; } } } for (int i = Balls.Count - 1; i >= 0; i--) { Ball current = Balls[i]; if (current.isHit) { ticksCounter = 0; if (Balls[i].Time >= 2) { Balls.RemoveAt(i); switch (current.Radius) { case 40: ball = new Ball(current.X + 40, current.Y, this.Width, this.Height, 32, -Math.PI / 4); Balls.Add(ball); ball = new Ball(current.X - 40, current.Y, this.Width, this.Height, 32, -3 * Math.PI / 4); Balls.Add(ball); this.scores += 10; break; case 32: ball = new Ball(current.X + 30, current.Y, this.Width, this.Height, 20, -Math.PI / 4); Balls.Add(ball); ball = new Ball(current.X - 30, current.Y, this.Width, this.Height, 20, -3 * Math.PI / 4); Balls.Add(ball); this.scores += 15; break; case 20: ball = new Ball(current.X + 20, current.Y, this.Width, this.Height, 8, -Math.PI / 4); Balls.Add(ball); ball = new Ball(current.X - 20, current.Y, this.Width, this.Height, 8, -3 * Math.PI / 4); Balls.Add(ball); this.scores += 20; break; case 8: this.scores += 25; break; } lblScore.Text = scores.ToString(); } break; } } }