public HenryBoss(ContentManager cm, HenryBattlefield b, float mass, Vector2 initPos, Vector2 initVel, float damping) : base(cm, b, 4000, mass, initPos, initVel, damping) { spawnerType = "Boss"; this.LoadContent("BossIdle", true); //initally idle this.CenterOrigin(); this.Animate = true; this.HitRadius = 65; EnginePower = 30.0f; staticFieldSprite = new HenrySprite(cm); staticFieldSprite.LoadContent("BossStaticField", true); staticFieldSprite.CenterOrigin(); staticFieldSprite.Scale = 0.6f; //starter weapon LaunchBays.Add(new LaunchBay(this, 0.6f, "PeaShooter", 100)); }
protected override void LoadContent() { // TODO: use this.Content to load your game content here GameFont = this.Content.Load<SpriteFont>("GameFont"); //Henry Stuff //general setup ButtonFont = this.Content.Load<SpriteFont>("ButtonFont"); ButtonFont.LineSpacing = 20; TitleFont = this.Content.Load<SpriteFont>("TitleFont"); TextFont = this.Content.Load<SpriteFont>("TextFont"); Fonts["Button"] = ButtonFont; Fonts["Title"] = TitleFont; Fonts["Text"] = TextFont; TheMouse = new HenryMouse(this.Content); Audio.LoadContent(); screens.Add("Exit", new HenryMenu(this.Content)); screens.Add("MainMenu", new HenryMenu(this.Content)); screens.Add("PlayerUpgradeMenu", new HenryScreen()); screens.Add("BossUpgradeMenu", new HenryScreen()); screens.Add("SaveMenu", new HenryMenu(this.Content)); screens.Add("LoadMenu", new HenryMenu(this.Content)); screens.Add("PlayerVictory", new HenryMenu(this.Content)); screens.Add("BossVictory", new HenryMenu(this.Content)); screens.Add("Credits", new HenryMenu(this.Content)); screens.Add("HowToPlay", new HenryMenu(this.Content)); screens.Add("Battlefield", new HenryScreen()); //note: not an actual battlefield. gets replaced by a battlefield generated on start game button click screens.Add("SessionOption", new HenryMenu(this.Content)); screens.Add("Lobby", new HenryMenu(this.Content)); screens.Add("ListSessions", new HenryMenu(this.Content)); screens.Add("PauseMenu", new HenryMenu(this.Content)); screens.Add("SignIn", new HenryMenu(this.Content)); //create main menu HenryMenu MainMenu = (HenryMenu)screens["MainMenu"]; MainMenu.AddButton(0.3f, 0.5f, "Notus SP", new OnClick(() => { screens["PlayerUpgradeMenu"] = new HenryUpgradeMenu(false); screens["BossUpgradeMenu"] = new HenryUpgradeMenu(true); screens["Battlefield"] = new HenryBattlefield(true); //new battlefield w/ boss mode true PlayerUpgradeMenu = (HenryUpgradeMenu)screens["PlayerUpgradeMenu"]; BossUpgradeMenu = (HenryUpgradeMenu)screens["BossUpgradeMenu"]; TheBattlefield = (HenryBattlefield)screens["Battlefield"]; //done so some things can reference the battlefield TheBattlefield.LoadContent(); RNSEB.CurrentScreen = "Battlefield"; })); MainMenu.AddButton(0.175f, 0.5f, "Zihao SP", new OnClick(() => { screens["PlayerUpgradeMenu"] = new HenryUpgradeMenu(false); screens["BossUpgradeMenu"] = new HenryUpgradeMenu(true); screens["Battlefield"] = new HenryBattlefield(false); //new battlefield w/ boss mode false, i.e. player mode true TheBattlefield = (HenryBattlefield)screens["Battlefield"]; //done so some things can reference the battlefield PlayerUpgradeMenu = (HenryUpgradeMenu)screens["PlayerUpgradeMenu"]; BossUpgradeMenu = (HenryUpgradeMenu)screens["BossUpgradeMenu"]; TheBattlefield.LoadContent(); RNSEB.CurrentScreen = "Battlefield"; })); MainMenu.AddButton(0.34f, 0.675f, "Multi-\nplayer", new OnClick(()=>{RNSEB.CurrentScreen = "SignIn";})); MainMenu.AddButton(0.7f, 0.5f, "Load", new OnClick(()=>{RNSEB.CurrentScreen = "LoadMenu";})); MainMenu.AddButton(0.66f, 0.675f, "Quit", new OnClick(()=>{RNSEB.CurrentScreen = "Exit";})); MainMenu.AddButton(0.5f, 0.75f, "How to\n Play", new OnClick(()=>{RNSEB.CurrentScreen = "HowToPlay";})); Color TitleColor = Color.White; MainMenu.AddText(0.5f, 0.15f, TitleFont, TitleColor, "Rising Nebula Star"); MainMenu.AddText(0.5f, 0.225f, TitleFont, TitleColor, "Extinction Battler:"); MainMenu.AddText(0.5f, 0.3f, TitleFont, TitleColor, "The Final Sin"); //todo: find a way to center justify text MainMenu.AddButton(0.5f, 0.5f, "", new OnClick(()=>{RNSEB.CurrentScreen = "Credits";}), "PlayerIdle", "PlayerHit", "PlayerDeath", 1.5f); //create how to play screen createHowToPlayMenus(); //see waay below! ////////////////////create load menu HenryMenu LoadMenu = (HenryMenu)screens["LoadMenu"]; LoadMenu.AddButton(0.9f, 0.9f, "Back", new OnClick(() => { RNSEB.CurrentScreen = "MainMenu"; })); LoadMenu.AddButton(0.5f, 0.5f, "Load Game", new OnClick(() => { Stream stream = File.Open("RNSEB_SAVE.osl", FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); TheBattlefield = (HenryBattlefield)bformatter.Deserialize(stream); stream.Close(); Stream strweam = File.Open("RNSEB_UGRAD.osl", FileMode.Open); BossUpgradeMenu = (HenryUpgradeMenu)bformatter.Deserialize(strweam); PlayerUpgradeMenu = (HenryUpgradeMenu)bformatter.Deserialize(strweam); strweam.Close(); screens["Battlefield"] = TheBattlefield; screens["PlayerUpgradeMenu"] = PlayerUpgradeMenu; screens["BossUpgradeMenu"] = BossUpgradeMenu; RNSEB.CurrentScreen = "Battlefield"; })); //Create Sign In Screen HenryMenu SignIn = (HenryMenu)screens["SignIn"]; SignIn.AddButton(0.9f, 0.9f, "Back", new OnClick(() => { RNSEB.CurrentScreen = "MainMenu"; })); SignIn.AddText(0.5f, 0.1f, TitleFont, Color.White, "Sign In"); SignIn.AddText(0.25f, 0.25f, TextFont, Color.White, "No profile signed in!\nPress the Home Key to Sign In."); //Create New/Search Session Screen HenryMenu SessionOption = (HenryMenu)screens["SessionOption"]; SessionOption.AddButton(0.9f, 0.9f, "Back", new OnClick(() => { RNSEB.CurrentScreen = "MainMenu"; })); SessionOption.AddText(0.5f, 0.1f, TitleFont, Color.White, "Lobby"); SessionOption.AddButton(0.35f, 0.3f, "New Session", new OnClick(() => { CreateSession(); RNSEB.CurrentScreen = "Lobby"; })); SessionOption.AddButton(0.65f, 0.3f, "Find Session", new OnClick(() => { FindSession(); RNSEB.CurrentScreen = "ListSessions"; })); //List Available Sessions Screen ListSessions = (HenryMenu)screens["ListSessions"]; ListSessions.AddButton(0.9f, 0.9f, "Back", new OnClick(() => { RNSEB.CurrentScreen = "SessionOption"; })); //Create Player Lobby Lobby = (HenryMenu)screens["Lobby"]; Lobby.AddButton(0.9f, 0.9f, "Back", new OnClick(() => { networkSession.Dispose(); RNSEB.CurrentScreen = "SessionOption"; })); //create pause menu HenryMenu PauseMenu = (HenryMenu)screens["PauseMenu"]; PauseMenu.AddText(0.5f, 0.1f, TitleFont, Color.White, "Paused"); PauseMenu.AddButton(0.5f, 0.5f, "Back", new OnClick(() => { RNSEB.CurrentScreen = "Battlefield"; })); PauseMenu.AddButton(0.7f, 0.5f, "Main Menu", new OnClick(() => { RNSEB.CurrentScreen = "MainMenu"; })); PauseMenu.AddButton(0.3f, 0.5f, "Save Game", new OnClick(() => { Stream strweam = File.Open("RNSEB_SAVE.osl", FileMode.Create); BinaryFormatter bformatter = new BinaryFormatter(); bformatter.Serialize(strweam, TheBattlefield); strweam.Close(); Stream stream = File.Open("RNSEB_UGRAD.osl", FileMode.Create); bformatter.Serialize(stream, BossUpgradeMenu); bformatter.Serialize(stream, PlayerUpgradeMenu); stream.Close(); RNSEB.CurrentScreen = "Battlefield"; })); //create credits screen HenryMenu Credits = (HenryMenu)screens["Credits"]; Credits.AddText(0.25f, 0.5f, TextFont, Color.White, "Matt Groot\nIan Wilbanks\nChris Rose\nEric See\nMatt Paniagua"); Credits.AddText(0.75f, 0.5f, TextFont, Color.White, "Henry Bodensteiner\nRyan Koym\nParker Leech\nEric See"); Credits.AddButton(0.5f, 0.75f, "Back", new OnClick(()=>{RNSEB.CurrentScreen = "MainMenu";})); //create player victory screen HenryMenu PlayerVictory = (HenryMenu)screens["PlayerVictory"]; PlayerVictory.AddText(0.5f, 0.1f, TitleFont, Color.White, "Zihao is the victor!"); PlayerVictory.AddText(0.5f, 0.5f, TextFont, Color.White, "The inexorable time marching shall be notus revenge"); PlayerVictory.AddButton(0.5f, 0.8f, "Main\nMenu", new OnClick(()=>{RNSEB.CurrentScreen = "MainMenu";})); //create boss victory screen HenryMenu BossVictory = (HenryMenu)screens["BossVictory"]; BossVictory.AddText(0.5f, 0.1f, TitleFont, Color.White, "Notus is teh victor!"); BossVictory.AddText(0.5f, 0.5f, TextFont, Color.White, "An infinity years of dark befall the universe"); BossVictory.AddButton(0.5f, 0.8f, "Main\nMenu", new OnClick(()=>{RNSEB.CurrentScreen = "MainMenu";})); }
//Handle Lobby Updates and Redraws public void HandleLobby(GameTime gameTime) { if (networkSession != null) { if (networkSession.SessionState == NetworkSessionState.Lobby) { if (Keyboard.GetState().IsKeyDown(Keys.A)) { foreach (LocalNetworkGamer gamer in networkSession.LocalGamers) gamer.IsReady = true; } Lobby.clearTexts(); Lobby.AddText(0.5f, 0.1f, TitleFont, Color.White, "Lobby"); Lobby.AddText(0.5f, 0.18f, TextFont, Color.White, "Press A When Ready"); float y = 0.25f; int gamernum = 0; foreach (NetworkGamer gamer in networkSession.AllGamers) { string text = gamer.Gamertag; User player = gamer.Tag as User; if (gamer.IsReady) text += " - ready!"; if (gamernum == 0) player.BossMode = false; else player.BossMode = true; Lobby.AddText(0.2f, y, TextFont, Color.White, text); y += 0.06f; gamernum++; } // The host checks if everyone is ready, and moves to game play if true. if (networkSession.IsEveryoneReady && networkSession.AllGamers.Count == 2) { elapsedTime = (float)gameTime.ElapsedGameTime.TotalSeconds; gameStartTimer -= elapsedTime; if (networkSession.IsHost && gameStartTimer <= 0) networkSession.StartGame(); if (gameStartTimer <= 0) { screens["PlayerUpgradeMenu"] = new HenryUpgradeMenu(false); screens["BossUpgradeMenu"] = new HenryUpgradeMenu(true); //If player is local (this computer) then create a battlefield with the correct Player/Boss mode foreach (NetworkGamer gamer in networkSession.AllGamers) { User player = gamer.Tag as User; if (gamer.IsLocal) { screens["Battlefield"] = new HenryBattlefield(player.BossMode, true); } } TheBattlefield = (HenryBattlefield)screens["Battlefield"]; TheBattlefield.LoadContent(); TheBattlefield.Zihao.nonRotate = TheBattlefield.BossMode; RNSEB.CurrentScreen = "Battlefield"; } } // Pump the underlying session object. networkSession.Update(); } } else { RNSEB.CurrentScreen = "SessionOption"; } }