Ejemplo n.º 1
0
        /// <summary>
        /// Gamestate game-logic loop.
        /// <para>1. Reads mouse input from the player and changes coords of the plate</para>
        /// <para>2. Moves the ball</para>
        /// <para>3. Processes all possible collisions</para>
        /// <para>4. Checks if the game is won, and ends the game if yes</para>
        /// </summary>
        private void UpdateGame()
        {
            plate.ChangeCoords(Mouse.GetState().X);

            ball.Move();

            // Check if ball arrives at any of the remaining bricks

            ProcessPossibleBrickCollisions();

            // Check if contacts Walls. Reverses vilocity if does.
            ProcessPossibleWallCollisions();

            // Check if ball arrives at the plate
            ProcessPossiblePlateCollision();

            if (_won = CheckIfWon())
            {
                EndGame();
            }
        }