예제 #1
0
 public void CheckCollision()
 {
     if (rect.IntersectsWith(parent.Ball.Hitbox))
     {
         if (parent.Ball.Posi.Y > this.posi.Y + this.rect.Height / 2)
         {
             parent.Ball.Richtung = new PointF(parent.Ball.Richtung.X, 1);
         } else if (parent.Ball.Posi.X < this.posi.X)
         {
             parent.Ball.Richtung = new PointF(-1, parent.Ball.Richtung.Y);
         } else if (parent.Ball.Posi.X > this.posi.X + this.rect.Width / 2)
         {
             parent.Ball.Richtung = new PointF(1, parent.Ball.Richtung.Y);
         } else if (parent.Ball.Posi.Y < this.posi.Y)
         {
             parent.Ball.Richtung = new PointF(parent.Ball.Richtung.X, -1);
         }
         isAlive = false;
         //parent.ball.HasHit = true;
         parent.Ball.Points += 1;
         CScrollingText scrollText = new CScrollingText(gfx, parent, "+1", -2, Point.Round(parent.Ball.Posi));
         parent.Timer1.Tick += scrollText.Tick;
         parent.playSound();
         parent.Ball.LetzterStein = this;
         SpawnUpgrade();
     }
 }
예제 #2
0
 public void CheckCollision()
 {
     if (parent.Paddel.Rect.IntersectsWith(rect))
     {
         parent.Paddel.Upgraded = true;
         isAlive = false;
         if (type == 0)
         {
             parent.startUpTimer(1000);
         }
         parent.Paddel.Laenge += modLaenge;
         parent.Ball.Points += modPoints;
         parent.setPoints(parent.Ball.Points);
         CScrollingText scrollText = new CScrollingText(gfx, parent, upgradeText, 2, posi);
         parent.Timer1.Tick += scrollText.Tick;
     }
 }