public MissileManager(Texture2D missileTexture, Vector2 missileOrigin, SpriteBatch spriteBatch, EnemyManager enemyManager, Scoreboard scoreboard) { this.missileTexture = missileTexture; this.missileOrigin = missileOrigin; this.spriteBatch = spriteBatch; this.enemyManager = enemyManager; this.scoreBoard = scoreboard; missiles = new List<Missile>(64); for (Int32 i = 0; i < 64; i++) { missiles.Add(new Missile(this.missileTexture, this.missileOrigin, this.spriteBatch)); } fireCounter = 0.0f; }
private void startTheGame() { scoreBoard = new Scoreboard(); scoreBoard.Font = Content.Load<SpriteFont>("gameFont"); int maxWidth = graphics.GraphicsDevice.Viewport.Width; int maxHeight = graphics.GraphicsDevice.Viewport.Height; enemyManager = new EnemyManager(this.Content.Load<Texture2D>("Enemy"), new Vector2(16), this.spriteBatch, maxWidth, maxHeight, scoreBoard); missileManager = new MissileManager(this.Content.Load<Texture2D>("Missile"), new Vector2(2.0f, 4.0f), this.spriteBatch, enemyManager, scoreBoard); //Setup player Texture2D playerTexture = Content.Load<Texture2D>("player"); int playerX = graphics.GraphicsDevice.Viewport.Width / 2; int playerY = graphics.GraphicsDevice.Viewport.Height - 50; player = new Player(playerTexture, new Vector2(playerX,playerY), this.spriteBatch, missileManager); Logger.log(Log_Type.INFO, "max width "+playerX*2); Logger.log(Log_Type.INFO, "max height " + (playerY + 50)); }