public override void Update() { player.Update(); ball.Update(player, blockManager.GetBlocks, score, highScore); EndGame(); }
/// <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(); } paddle.Input(); // TODO: Add your update logic here ball.Update(); ball.CheckCollision(paddle, wall); base.Update(gameTime); }
public void Update(KeyboardState kstate, GameTime gameTime) { if (active) { paddle.Update(kstate, gameTime, ball); ball.Update(kstate, gameTime, level, paddle); level.Delete(); if (level.blocks.Count == 0) { numberLevel++; if (numberLevel >= 10) { numberLevel = 1; } ball = new Ball(game, game.Content.Load <Texture2D>("png/ballBlue"), new Vector2(0, 0)); paddle = new Paddle(game, game.Content.Load <Texture2D>("png/paddleRed"), new Vector2(0, 0)); level = new Level(game, numberLevel); } } }