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); }
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); }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here UpdatePlayer(gameTime); ball.Update(gameTime); UpdateBlocks(gameTime); UpdateCollision(); base.Update(gameTime); }