public ActionScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { // TODO: Construct any child components here this.spriteBatch = spriteBatch; SoundEffect explosionSound = game.Content.Load <SoundEffect>("Sounds/explosionSound"); Texture2D tex = game.Content.Load <Texture2D>("Images/spaceShipIcon"); Vector2 stage = new Vector2(Shared.stage.X, Shared.stage.Y); Vector2 pos = new Vector2(stage.X / 2, stage.Y / 2); Vector2 speed = new Vector2(1, 1); ship = new Ship(game, spriteBatch, tex, pos, speed, Shared.stage); this.Components.Add(ship); cm = new CollisionManager(game, spriteBatch, asteroids, ship, explosionSound); this.Components.Add(cm); caption = new LevelCaption(Game, spriteBatch, Shared.stage, "Level 1"); Components.Add(caption); string scoreText = "Score: " + score + "\nLevel: " + level; SpriteFont font = game.Content.Load <SpriteFont>("Fonts/regularFont"); inGameDisplay = new SimpleString(game, spriteBatch, font, new Vector2(0, 0), scoreText, Color.LimeGreen); this.Components.Add(inGameDisplay); }
public void GameOver() { if (ship.IsHit == true) { Game.Components.Remove(ship.Bullet); SaveHighScore(); string gameOverText = "Game Over... Score: " + score + "\npress esc key to return to menu"; SpriteFont font = Game.Content.Load <SpriteFont>("Fonts/regularFont"); gameOverMessage = new SimpleString(Game, spriteBatch, font, new Vector2(Shared.stage.X / 2 - font.MeasureString(gameOverText).X / 2, Shared.stage.Y / 2), gameOverText, Color.LimeGreen); this.Components.Add(gameOverMessage); cm.Enabled = false; } }
public AboutScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { // TODO: Construct any child components here this.spriteBatch = spriteBatch; string screenTitle = "About"; SpriteFont font = game.Content.Load <SpriteFont>("Fonts/titleFont"); title = new SimpleString(game, spriteBatch, font, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y / 6), screenTitle, Color.LimeGreen); this.Components.Add(title); string aboutInfo = "Game Created By:\nMatthew Van Boxtel\nSangkyun Park"; SpriteFont bodyFont = game.Content.Load <SpriteFont>("Fonts/bodyFont"); body = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y / 2), aboutInfo, Color.LimeGreen); this.Components.Add(body); }
public HighScoreScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { // TODO: Construct any child components here this.spriteBatch = spriteBatch; GetHighScores(); string screenTitle = "High Score"; SpriteFont font = game.Content.Load <SpriteFont>("Fonts/titleFont"); title = new SimpleString(game, spriteBatch, font, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y / 6), screenTitle, Color.LimeGreen); this.Components.Add(title); SpriteFont bodyFont = game.Content.Load <SpriteFont>("Fonts/bodyFont"); body = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y / 2), highScores, Color.LimeGreen); this.Components.Add(body); }
public SplashScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { // TODO: Construct any child components here this.spriteBatch = spriteBatch; string screenTitle = "Masteroids"; SpriteFont font = game.Content.Load <SpriteFont>("Fonts/titleFont"); title = new SimpleString(game, spriteBatch, font, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2 - 200, Shared.stage.Y / 6), screenTitle, Color.LimeGreen); this.Components.Add(title); menu = new MenuItem(game, spriteBatch, game.Content.Load <SpriteFont>("Fonts/regularFont"), game.Content.Load <SpriteFont>("Fonts/hilightFont"), new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2 + font.MeasureString(screenTitle).X / 6 + 200, Shared.stage.Y / 2 + 100), menuItems); this.Components.Add(menu); menuImage = new KeyItem(game, spriteBatch, game.Content.Load <Texture2D>("Images/menuScreen"), Shared.stage / 2, Shared.stage / 2); this.Components.Add(menuImage); }
public HowToPlayScreen(Game game, SpriteBatch spriteBatch) : base(game, spriteBatch) { // TODO: Construct any child components here this.spriteBatch = spriteBatch; string screenTitle = "How To Play"; SpriteFont font = game.Content.Load <SpriteFont>("Fonts/titleFont"); title = new SimpleString(game, spriteBatch, font, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y / 6), screenTitle, Color.LimeGreen); this.Components.Add(title); Vector2 stage = new Vector2(Shared.stage.X, Shared.stage.Y); // draw keys Texture2D tex = game.Content.Load <Texture2D>("Images/WKey1"); Vector2 pos = new Vector2(stage.X / 4, stage.Y - 550); wKey = new KeyItem(game, spriteBatch, tex, pos, Shared.stage); this.Components.Add(wKey); Texture2D tex1 = game.Content.Load <Texture2D>("Images/AKey1"); Vector2 pos1 = new Vector2(stage.X / 4, stage.Y - 500); aKey = new KeyItem(game, spriteBatch, tex1, pos1, Shared.stage); this.Components.Add(aKey); Texture2D tex2 = game.Content.Load <Texture2D>("Images/DKey1"); Vector2 pos2 = new Vector2(stage.X / 4, stage.Y - 450); dKey = new KeyItem(game, spriteBatch, tex2, pos2, Shared.stage); this.Components.Add(dKey); Texture2D tex3 = game.Content.Load <Texture2D>("Images/SpaceKey1"); Vector2 pos3 = new Vector2(stage.X / 4 + 90, stage.Y - 400); spaceKey = new KeyItem(game, spriteBatch, tex3, pos3, Shared.stage); this.Components.Add(spaceKey); Texture2D tex4 = game.Content.Load <Texture2D>("Images/EscKey1"); Vector2 pos4 = new Vector2(stage.X / 4, stage.Y - 350); escKey = new KeyItem(game, spriteBatch, tex4, pos4, Shared.stage); this.Components.Add(escKey); // draw key descriptions SpriteFont bodyFont = game.Content.Load <SpriteFont>("Fonts/bodyFont"); string desc = "Move Forward"; wDesc = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y - 560), desc, Color.LimeGreen); this.Components.Add(wDesc); string desc1 = "Turn Left"; aDesc = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y - 510), desc1, Color.LimeGreen); this.Components.Add(aDesc); string desc2 = "Turn Right"; dDesc = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y - 460), desc2, Color.LimeGreen); this.Components.Add(dDesc); string desc3 = "Fire Weapon"; spaceDesc = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2 + 100, Shared.stage.Y - 410), desc3, Color.LimeGreen); this.Components.Add(spaceDesc); string desc4 = "Back to Menu"; escDesc = new SimpleString(game, spriteBatch, bodyFont, new Vector2(Shared.stage.X / 2 - font.MeasureString(screenTitle).X / 2, Shared.stage.Y - 360), desc4, Color.LimeGreen); this.Components.Add(escDesc); }