Exemplo n.º 1
0
        public void PowerUpCollision(PowerUps p)
        {
            Rectangle powerRec  = new Rectangle(p.x, p.y, p.width, p.height);
            Rectangle paddleRec = new Rectangle(x, y, width, height);

            if (p.power == "longPaddle")
            {
                if (paddleRec.IntersectsWith(powerRec))
                {
                    width += 40;
                    p.x    = 2000;
                }
            }
            else if (p.power == "shortPaddle")
            {
                if (paddleRec.IntersectsWith(powerRec))
                {
                    width -= 40;
                    p.x    = 2000;
                }
            }
            else if (p.power == "extraLife")
            {
                if (paddleRec.IntersectsWith(powerRec))
                {
                    GameScreen.playerLives++;
                    p.x = 2000;
                }
            }
            else if (p.power == "fastPaddle")
            {
                if (paddleRec.IntersectsWith(powerRec))
                {
                    GameScreen.paddleSpeed += 30;
                    p.x = 2000;
                }
            }
        }
Exemplo n.º 2
0
 public void JordanMethod()
 {
     powerPick = randJord.Next(1, 5);
     if (powerPick == 1)
     {
         PowerUps extraLife = new PowerUps(ball.x, ball.y, 20, 20, "extraLife");
         powers.Add(extraLife);
     }
     else if (powerPick == 2)
     {
         PowerUps longPaddle = new PowerUps(ball.x, ball.y, 20, 20, "longPaddle");
         powers.Add(longPaddle);
     }
     else if (powerPick == 3)
     {
         PowerUps shortPaddle = new PowerUps(ball.x, ball.y, 20, 20, "shortPaddle");
         powers.Add(shortPaddle);
     }
     else if (powerPick == 4)
     {
         PowerUps fastPaddle = new PowerUps(ball.x, ball.y, 20, 20, "fastPaddle");
         powers.Add(fastPaddle);
     }
 }