public void Draw(SpriteBatch spriteBatch, Player player) { spriteBatch.Draw(menuBar, position, Color.White); string moneyText = string.Format("{0}", player.getMoney); string hpsText = string.Format("Hp", player.getHitpoints); string waveText = string.Format("Wave {0}", EnemyWave.getWaveCount); string scoreText = string.Format("Score {0}", EnemyWave.getNumEnemiesDead * player.getSpentMoney); spriteBatch.DrawString(font, moneyText, moneyTextPosition, Color.Gold); spriteBatch.DrawString(font, hpsText, hpsTextPosition, player.getColor); spriteBatch.DrawString(font, waveText, waveTextPosition, Color.CadetBlue); spriteBatch.DrawString(font, scoreText, scoreTextPosition, Color.DarkOrange); }
public EnemyWave(int waveCount, int enemyNumber, EnemyPathing enemyPathing, SpriteAnimator spriteAnimation, Player player, StartWaveButton startWaveButton, Texture2D hitpointBar, Vector2 hitpointBarPosition) { EnemyWave.waveCount = waveCount; this.enemyNumber = enemyNumber; this.enemyPathing = enemyPathing; this.spriteAnimation = spriteAnimation; this.player = player; this.startWaveButton = startWaveButton; this.hitpointBar = hitpointBar; this.hitpointBarPosition = hitpointBarPosition; }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //audio laserBlast = Content.Load<SoundEffect>("Audio/laserBlast"); sound = new Sound(laserBlast); //music bgMusic = Content.Load<Song>("Audio/drMario"); MediaPlayer.IsRepeating = true; //tile content Texture2D grass = Content.Load<Texture2D>("images/grass"); Texture2D road = Content.Load<Texture2D>("images/road"); //sets the tiles in order as numbers in the tiles array tileMap.tiles.Add(grass); tileMap.tiles.Add(road); //Fire Radius radiusTexture = Content.Load<Texture2D>("images/radius"); //tower content Texture2D towerTexture = Content.Load<Texture2D>("images/tower"); Texture2D projectileTexture = Content.Load<Texture2D>("images/laser"); //Game Menu sideBar = Content.Load<Texture2D>("images/GUIstuff/menuBar"); font = Content.Load<SpriteFont>("SpriteFonts/MoneyFont"); menuBarPosition = new Vector2((graphics.PreferredBackBufferWidth - sideBar.Width), 0); menuBar = new MenuBar(sideBar, font, menuBarPosition); //Hitpoint Bar hitpointBar = Content.Load<Texture2D>("images/GUIstuff/healthBar"); hitpointBarOverlay = Content.Load<Texture2D>("images/GUIstuff/healthBarOverlay"); hitpointBarPosition.X = menuBarPosition.X + 125; hitpointBarPosition.Y = menuBarPosition.Y + 17; //Start Button startButton = Content.Load<Texture2D>("images/GUIstuff/startButton"); buttonPosition = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); startWaveButton = new StartWaveButton(startButton, buttonPosition, Color.White); //player content player = new Player(tileMap, towerTexture, projectileTexture, radiusTexture, startWaveButton, hitpointBar, hitpointBarPosition); //bunny spriteSheet Texture2D bunnySheet = Content.Load<Texture2D>("images/bunnySheet"); //enemy content Texture2D rabbitTexture = Content.Load<Texture2D>("images/rabbitEnemy2"); rabbitAnimation = new SpriteAnimator(bunnySheet, new Point(5, 2)); enemyWave = new EnemyWave(0, 10, pathing, rabbitAnimation, player, startWaveButton, hitpointBar, hitpointBarPosition); //Game State screenState = new GameState(); startScreen = Content.Load<Texture2D>("images/ScreenStates/StartScreen"); gameOverScreen = Content.Load<Texture2D>("images/ScreenStates/GameOverScreen"); gameWinScreen = Content.Load<Texture2D>("images/ScreenStates/GameWinScreen"); }