コード例 #1
0
        private void Update_TwoBallGame(GameTime gameTime)
        {
            ball_1.Update(gameTime);
            Collisions.Check_Border_colision(graphics, ball_1);
            Collisions.upperWallHit_shrink(graphics, ball_1, paddle);

            Collisions.Check_Sprite_colision(ball_1, paddle, false);
            paddle.Rebound_from_Paddle(ball_1);
            theBrick_Manager.check_Collisions(ball_1, true);

            if (Collisions.ballCollided)
            {
                ball_2.Update(gameTime);
                Collisions.Check_Border_colision(graphics, ball_2);
                Collisions.upperWallHit_shrink(graphics, ball_2, paddle);

                Collisions.Check_Sprite_colision(ball_2, paddle, false);
                paddle.Rebound_from_Paddle(ball_2);
                theBrick_Manager.check_Collisions(ball_2, true);

                Collisions.Check_Sprite_colision(ball_1, ball_2, false);
            }
            paddle.Update();
            Collisions.Check_Border_colision(graphics, paddle);
        }
コード例 #2
0
 public void check_Collisions(Ball ball, bool killable)
 {
     for (int r = 0; r < rows; r++)
     {
         for (int u = 0; u < bricks_per_row; u++)
         {
             Collisions.Check_Sprite_colision(ball, brick_layout[r, u], killable);
         }
     }
 } // END check_Colisions();
コード例 #3
0
        public void Update_OneBallGame(GameTime gameTime)
        {
            if (ball_1.Position.Y <= paddle.Position.Y) // Game stops is ball is beyond paddle Y coordinates
            {
                ball_1.Update(gameTime);
                Collisions.Check_Border_colision(graphics, ball_1);
                Collisions.upperWallHit_shrink(graphics, ball_1, paddle);
            }

            paddle.Update();
            Collisions.Check_Border_colision(graphics, paddle);
            Collisions.Check_Sprite_colision(ball_1, paddle, false);
            paddle.Rebound_from_Paddle(ball_1);
            theBrick_Manager.check_Collisions(ball_1, true);
        }