private void ResetGame()
        {
            _random = new Random();
            Cursor.Hide();
            _playground = new Playground(this);
            _playground.FullScreen();

            _ball = new Ball
            {
                X = 4,
                Y = 4
            };

            _racket = new Racket(racket, Bottom);
            _score  = new Score(points);

            _gameover = new Gameover(gameover);
            _gameover.Hide();
            _gameover.Center(_playground);

            timer1.Enabled = true;
        }
 public bool HitsCeilingOf(Playground playground)
 {
     return(_bounds.Top <= playground.Bounds.Top);
 }
 public bool HitsWallsOf(Playground playground)
 {
     return(_bounds.Left <= playground.Bounds.Left ||
            _bounds.Right >= playground.Bounds.Right);
 }
Exemple #4
0
 public void Center(Playground playground)
 {
     _control.Left    = playground.Bounds.Width / 2 - _control.Width / 2;
     _control.Top     = playground.Bounds.Height / 2 - _control.Height / 2;
     _control.Visible = false;
 }