/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); spriteBatch.DrawString(font, "Position: " + currentMouseState.X + ", " + currentMouseState.Y, new Vector2(0, 0), Color.Black); switch (gameState) { case GameState.Title: spriteBatch.DrawString(font, "Titlescreen", new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.Red); break; case GameState.Game: // //map drawing // mapGraph.MapDraw(spriteBatch); // //enemies+towers drawing if (enemies[0].Alive == true) { enemyGraph.Draw(gameTime, spriteBatch, new Vector2(enemies[0].Position.X, enemies[0].Position.Y)); } towerGraph.Draw(gameTime, spriteBatch, new Vector2(towers[0].Position.X, towers[0].Position.Y)); // // // //storedrawing // storeBack.StaticImage(0, 1f, spriteBatch); // listing1.StaticImage(1, .66f, spriteBatch); // listing2.StaticImage(1, .66f, spriteBatch); // listing3.StaticImage(1, .66f, spriteBatch); spriteBatch.DrawString(font, "Knight \n Price: " + towers[0].Cost, new Vector2(465, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); spriteBatch.DrawString(font, "Tower Name \n Price: " + 150, //replace with price variable later // new Vector2(565, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); // spriteBatch.DrawString(font, "Tower Name \n Price: " + 100, //replace with price variable later // new Vector2(665, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); // // spriteBatch.DrawString(font, "Level: " + level, new Vector2(665, 15), Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); // spriteBatch.DrawString(font, "Funds available: " + money, //replace with money variable later // new Vector2(10, 510), Color.Black, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); // spriteBatch.DrawString(font, "Score: " + player.Points, //replace with score variable // new Vector2(10, 535), Color.Black, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); break; } spriteBatch.End(); base.Draw(gameTime); }
/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); //spriteBatch.DrawString(font, "Position: " + currentMouseState.X + ", " + currentMouseState.Y, new Vector2(0, 0), Color.Black); switch (gameState) { case GameState.Title: menuScreen.StaticImage(1, 1, spriteBatch); if (howToMenu == true) { if (howToPage == 1) { howTo1.StaticImage(1, 1, spriteBatch); } else if (howToPage == 2) { howTo2.StaticImage(1, 1, spriteBatch); } } break; case GameState.Game: if (isBought == true) { boughtSym.Draw(gameTime, spriteBatch, new Vector2(mX, mY)); } //spriteBatch.DrawString(font, "Position: " + currentMouseState.X + ", " + currentMouseState.Y, new Vector2(800, 0), Color.Black); // displays current mouse position //spriteBatch.DrawString(font, "Towers: " + towers.Count, new Vector2(800, 50), Color.Black); // displays current number of towers //s//priteBatch.DrawString(font, "Enemies: " + enemies.Count, new Vector2(800, 100), Color.Black); // displays current number of enemies //spriteBatch.DrawString(font, "Bought: " + isBought, new Vector2(800, 200), Color.Black); //.DrawString(font, "EnemyNum: " + enemyNum, new Vector2(800, 250), Color.Black); //spriteBatch.DrawString(font, "EnemyCount: " + enemyCount, new Vector2(800, 300), Color.Black); //map drawing if (level <= 5) { mapGraph.MapDraw(spriteBatch); } if (level > 5) { mapGraph2.MapDraw(spriteBatch); } for (int i = 0; i < enemies.Count(); i++) { if (enemies[i].Alive == true) { enemyGraphs[i].Draw(gameTime, spriteBatch, new Vector2(enemies[i].Position.X, enemies[i].Position.Y)); } } //each tower in towers for (int i = 0; i < towers.Count(); i++) { //currently doesn't check if tower is alive, need tower.alive property, and to actually assign a value to Alive at some point (currently not returning anything) //if (tow.Alive == true) //{ towerGraphs[i].Draw(gameTime, spriteBatch, new Vector2(towers[i].Position.X, towers[i].Position.Y)); //} } //storedrawing storeBack.StaticImage(0, 1f, spriteBatch); listing1.StaticImage(1, .66f, spriteBatch); listing2.StaticImage(1, .66f, spriteBatch); listing3.StaticImage(1, .66f, spriteBatch); towerGraphsPlaceholders[0].SizeChangeDraw(gameTime, spriteBatch, new Vector2(483, 555), 0.66f); spriteBatch.DrawString(font, "Knight \n Price: $100", new Vector2(465, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); spriteBatch.DrawString(font, "Lancer \n Price: $" + 150, //replace with price variable later new Vector2(565, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); spriteBatch.DrawString(font, "Advance to\nunlock\ntowers!", //replace with price variable later new Vector2(665, 515), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); if (level > 5) { towerGraphsPlaceholders[1].SizeChangeDraw(gameTime, spriteBatch, new Vector2(584, 555), 0.66f); } else { spriteBatch.DrawString(font, " Unlock at \n lv.5", new Vector2(565, 545), Color.Black, 0, Vector2.Zero, 0.45f, SpriteEffects.None, 1); } spriteBatch.DrawString(font, "Level: " + level, new Vector2(665, 15), Color.White, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); spriteBatch.DrawString(font, "Health: " + player.Health, new Vector2(600, 470), Color.White); //displays Current Health spriteBatch.DrawString(font, "Funds available: " + money, new Vector2(10, 510), Color.Black, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); spriteBatch.DrawString(font, "Score: " + player.Points, new Vector2(10, 535), Color.Black, 0, Vector2.Zero, 0.7f, SpriteEffects.None, 1); break; case GameState.GameOver: spriteBatch.DrawString(font, "Game Over", new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, GraphicsDevice.Viewport.Height / 2 - 100), Color.Black); spriteBatch.DrawString(font, "Score: " + player.Points, new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, GraphicsDevice.Viewport.Height / 2 - 50), Color.Black); spriteBatch.DrawString(font, "Total Enemies Killed: " + enemiesKilled, new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, GraphicsDevice.Viewport.Height / 2), Color.Black); break; case GameState.Results: spriteBatch.DrawString(font, "Results:", new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, 100), Color.Black); spriteBatch.DrawString(font, "Total Enemies Killed: " + totalEnemiesKilled, new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, 150), Color.Black); spriteBatch.DrawString(font, "Total Points: " + player.Points, new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, 200), Color.Black); spriteBatch.DrawString(font, "Current Money: $" + money, new Vector2(GraphicsDevice.Viewport.Width / 2 - 100, 250), Color.Black); break; } spriteBatch.End(); base.Draw(gameTime); }