public Breakout(SpriteBatch spriteBatch) { this.spriteBatch = spriteBatch; this.screenWidth = spriteBatch.GraphicsDevice.Viewport.Width; this.screenHeight = spriteBatch.GraphicsDevice.Viewport.Height; this.paddle = new Paddle(screenWidth, screenHeight); this.wall = new Wall(screenWidth, screenHeight); this.ball = new Ball(paddle, wall, screenWidth, screenHeight); }
/// <summary> /// Creates a new ball. The breakout game should only need once of these, /// unless I make it so more than one ball is active at a time. /// </summary> /// <param name="paddle">The Paddle which will hit the ball</param> /// <param name="screenWidth">Width of the screen for bounds checking.</param> /// <param name="screenHeight">Height of the screen for bounds checking.</param> public Ball(Paddle paddle, Wall wall, int screenWidth, int screenHeight) { this.state = State.Active; this.paddle = paddle; this.wall = wall; this.screenWidth = screenWidth; this.screenHeight = screenHeight; initialPosition = new Vector2(screenWidth / 2, screenHeight / 2); }