Ejemplo n.º 1
0
        private void OnGameTimerTick()
        {
            _ball.MoveBall();
            _bp.MoveSpecial();
            _bp.CheckSpecialDropCollision(_ball, _controller);
            _ball.PaddleCollision(_controller.ControllerForm);
            _ball.BrickCollision(_bp.BrickPatternMatrix);
            fps.Text = calculateFrameRate().ToString();
            var numberCol = _bp.CheckCollisions(_ball.BallForm);

            if (numberCol > 0)
            {
                _points         += numberCol;
                Point_count.Text = _points.ToString();
            }
            if (_points == 21)
            {
                _endGame        = true;
                winMenu.Visible = true;
            }
            if (!_ball.BordersColisions())
            {
                TakeLife();
                if (_lifes == 0)
                {
                    _endGame         = true;
                    gameOver.Visible = true;
                }
                else
                {
                    GameRestart();
                }
            }
            Invalidate();
        }