public SingleplayerScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { Resources.Instance.PlayerOneScore = 0; Resources.Instance.PlayerTwoScore = 0; Resources.Instance.GameOver = false; Resources.Instance.PortBall = false; SpriteManager.Sprite ball = new SpriteManager.BallSprite(game, spriteBatch); // The ball is added here because I needed to find a way to // to transfer the ball location from one black hole to another. // It was hard to do this without a reference in my singleton // that made it easy to get the information and set it. I would // appreciate any better input on how to do this. Resources.Instance.SetBall(ball); // Adds in all components used throughout a singleplayer game _manager = new SpriteManager.SpriteManager(game); _manager.AddSprite(ball); _manager.AddSprite(new SpriteManager.FrameSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.PlayerOneSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.ComputerPlayerSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.AsteroidSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.AsteroidSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.AsteroidSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.HoleSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.HoleSprite(game, spriteBatch)); _manager.AddSprite(new SpriteManager.WeaknessSprite(game, spriteBatch, new Vector2(8, game.GraphicsDevice.Viewport.Height / 2), 1)); _manager.AddSprite(new SpriteManager.WeaknessSprite(game, spriteBatch, new Vector2(game.GraphicsDevice.Viewport.Width - 8, game.GraphicsDevice.Viewport.Height / 2), 2)); game.Components.Add(_manager); }
public GameScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { GameProperties.Instance.Score = 0; GameProperties.Instance.GameOver = false; this._spriteManager = new SpriteManager.SpriteManager(game); this._keyboard = new Controllers.SoarKeyboard(game); SpriteManager.Bird bird = new SpriteManager.Bird(game, spriteBatch); GameProperties.Instance.setBird(bird); this._spriteManager.AddSprite(new SpriteManager.Background(game, spriteBatch)); this._spriteManager.AddSprite(new SpriteManager.BlackBird(game, spriteBatch)); this._spriteManager.AddSprite(new SpriteManager.BlackBird(game, spriteBatch)); this._spriteManager.AddSprite(new SpriteManager.BlackBird(game, spriteBatch)); this._spriteManager.AddSprite(new SpriteManager.Pond(game, spriteBatch)); this._spriteManager.AddSprite(bird); game.Components.Add(_spriteManager); game.Components.Add(_keyboard); }