public void TriggerEndRound(MapEditor mapEditor, int mapNumber) { ScoreKeeper.Instance.CalculateWinner(); int LeftSide = 0; int RightSide = 0; if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.LeftWins) { LeftSide = (int)GameObjectTypes.YOUWIN; RightSide = (int)GameObjectTypes.YOULOSE; } if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.RightWins) { LeftSide = (int)GameObjectTypes.YOULOSE; RightSide = (int)GameObjectTypes.YOUWIN; } if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.Tie) { LeftSide = (int)GameObjectTypes.YOUWIN; RightSide = (int)GameObjectTypes.YOUWIN; } //left int key = factory.Create(LeftSide, Vector2.Zero, "scoresheet", Vector2.Zero, 0f, 0f, 0f, 64); factory.Objects[key].sprite.Location = new Vector2(-1080 + ((12234 / 3) / 2) - (factory.Objects[key].sprite.BoundingBoxRect.Width / 2), -1217 + (2700 / 2)/*should be height of screen*/ - (factory.Objects[key].sprite.BoundingBoxRect.Height / 2)); RemoveAfterGameEnding(key, 9200, mapEditor, mapNumber); //right int key2 = factory.Create(RightSide, Vector2.Zero, "scoresheet", Vector2.Zero, 0f, 0f, 0f, 64); factory.Objects[key2].sprite.Location = new Vector2(-1080 + (2 * 12234 / 3) + ((12234 / 3) / 2) - (factory.Objects[key2].sprite.BoundingBoxRect.Width / 2), -1217 + (2700 / 2)/*should be height of screen*/ - (factory.Objects[key2].sprite.BoundingBoxRect.Height / 2)); RemoveAfter(key2, 9200); }
public void TriggerEndRound(MapEditor mapEditor, int mapNumber) { ScoreKeeper.Instance.CalculateWinner(); int LeftSide = 0; int RightSide = 0; if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.LeftWins) { LeftSide = (int)GameObjectTypes.YOUWIN; RightSide = (int)GameObjectTypes.YOULOSE; } if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.RightWins) { LeftSide = (int)GameObjectTypes.YOULOSE; RightSide = (int)GameObjectTypes.YOUWIN; } if (ScoreKeeper.Instance.winningSituation == ScoreKeeper.WinningSituations.Tie) { LeftSide = (int)GameObjectTypes.YOUWIN; RightSide = (int)GameObjectTypes.YOUWIN; } //left int key = factory.Create(LeftSide, Vector2.Zero, "scoresheet", Vector2.Zero, 0f, 0f, 0f, 64); factory.Objects[key].sprite.Location = new Vector2(-1080 + ((12234 / 3) / 2) - (factory.Objects[key].sprite.BoundingBoxRect.Width / 2), -1217 + (2700 / 2) /*should be height of screen*/ - (factory.Objects[key].sprite.BoundingBoxRect.Height / 2)); RemoveAfterGameEnding(key, 9200, mapEditor, mapNumber); //right int key2 = factory.Create(RightSide, Vector2.Zero, "scoresheet", Vector2.Zero, 0f, 0f, 0f, 64); factory.Objects[key2].sprite.Location = new Vector2(-1080 + (2 * 12234 / 3) + ((12234 / 3) / 2) - (factory.Objects[key2].sprite.BoundingBoxRect.Width / 2), -1217 + (2700 / 2) /*should be height of screen*/ - (factory.Objects[key2].sprite.BoundingBoxRect.Height / 2)); RemoveAfter(key2, 9200); }
public void RemoveAfterGameEnding(int SpriteKey, float RemoveTime, MapEditor mapEditor, int mapNumber) { items.Add(new TimedItem( delegate() { GameObjectFactory.Instance.Remove(SpriteKey); mapEditor.LoadMap(mapNumber); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////remove this if not satisfactory MediaPlayer.Play(funnymusic); }, RemoveTime)); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here GameWorld.Initialize(0, 5700, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height, new Vector2(0, 9.8f)); GameWorld.ViewPortXOffset = 0; SpriteCreators.Load("Content\\spritesheet.txt"); // Create the texture manager textureManager = new TextureManager(Content); // Now load the sprite creator factory helper factory = GameObjectFactory.Instance; factory.Initialize(textureManager); cannonManager = new CannonManager(); cannonGroups = new List <CannonGroups>(); client = new ClientNetworking(); client.Connect(); client.ActionHandler["shoot"] = new EventHandler(this.HandleNetworkShoot); client.ActionHandler["create"] = new EventHandler(this.HandleNetworkCreate); // Add a few sprite creators factory.AddCreator((int)GameObjectTypes.CAT, SpriteCreators.CreateCat); factory.AddCreator((int)GameObjectTypes.DOG, SpriteCreators.CreateDog); factory.AddCreator((int)GameObjectTypes.BOOM, SpriteCreators.CreateBoom); factory.AddCreator((int)GameObjectTypes.WOOD1, SpriteCreators.CreateWood1); factory.AddCreator((int)GameObjectTypes.WOOD2, SpriteCreators.CreateWood2); factory.AddCreator((int)GameObjectTypes.WOOD3, SpriteCreators.CreateWood3); factory.AddCreator((int)GameObjectTypes.WOOD4, SpriteCreators.CreateWood4); factory.AddCreator((int)GameObjectTypes.PLATFORM_LEFT, SpriteCreators.CreatePlatformLeft); factory.AddCreator((int)GameObjectTypes.PLATFORM_MIDDLE, SpriteCreators.CreatePlatformMiddle); factory.AddCreator((int)GameObjectTypes.PLATFORM_RIGHT, SpriteCreators.CreatePlatformRight); factory.AddCreator((int)GameObjectTypes.CANNON, SpriteCreators.CreateCannon); factory.AddCreator((int)GameObjectTypes.CANNONWHEEL, SpriteCreators.CreateCannonWheel); factory.AddCreator((int)GameObjectTypes.POWERMETERBAR, SpriteCreators.CreatePowerMeterBar); factory.AddCreator((int)GameObjectTypes.POWERMETERTAB, SpriteCreators.CreatePowerMeterTab); mapEditor = new MapEditor(Window, client, cannonManager, cannonGroups); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here GameWorld.Initialize(0, 5700, this.Window.ClientBounds.Width, this.Window.ClientBounds.Height, new Vector2(0, 9.8f)); GameWorld.ViewPortXOffset = 0; SpriteCreators.Load("Content\\spritesheet.txt"); // Create the texture manager textureManager = new TextureManager(Content); // Now load the sprite creator factory helper factory = GameObjectFactory.Instance; factory.Initialize(textureManager); cannonManager = new CannonManager(); cannonGroups = new List<CannonGroups>(); client = new ClientNetworking(); client.Connect(); client.ActionHandler["shoot"] = new EventHandler(this.HandleNetworkShoot); client.ActionHandler["create"] = new EventHandler(this.HandleNetworkCreate); // Add a few sprite creators factory.AddCreator((int)GameObjectTypes.CAT, SpriteCreators.CreateCat); factory.AddCreator((int)GameObjectTypes.DOG, SpriteCreators.CreateDog); factory.AddCreator((int)GameObjectTypes.BOOM, SpriteCreators.CreateBoom); factory.AddCreator((int)GameObjectTypes.WOOD1, SpriteCreators.CreateWood1); factory.AddCreator((int)GameObjectTypes.WOOD2, SpriteCreators.CreateWood2); factory.AddCreator((int)GameObjectTypes.WOOD3, SpriteCreators.CreateWood3); factory.AddCreator((int)GameObjectTypes.WOOD4, SpriteCreators.CreateWood4); factory.AddCreator((int)GameObjectTypes.PLATFORM_LEFT, SpriteCreators.CreatePlatformLeft); factory.AddCreator((int)GameObjectTypes.PLATFORM_MIDDLE, SpriteCreators.CreatePlatformMiddle); factory.AddCreator((int)GameObjectTypes.PLATFORM_RIGHT, SpriteCreators.CreatePlatformRight); factory.AddCreator((int)GameObjectTypes.CANNON, SpriteCreators.CreateCannon); factory.AddCreator((int)GameObjectTypes.CANNONWHEEL, SpriteCreators.CreateCannonWheel); factory.AddCreator((int)GameObjectTypes.POWERMETERBAR, SpriteCreators.CreatePowerMeterBar); factory.AddCreator((int)GameObjectTypes.POWERMETERTAB, SpriteCreators.CreatePowerMeterTab); mapEditor = new MapEditor(Window, client, cannonManager, cannonGroups); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here GameWorld.Initialize(0, 12234 - (1080 * 2), this.Window.ClientBounds.Width, this.Window.ClientBounds.Height, new Vector2(0, 9.8f)); GameWorld.ViewPortXOffset = 0; SpriteCreators.Load("Content\\spritesheet.txt"); MapLoaded = false; // Create the texture manager textureManager = new TextureManager(Content); //Create the audio manager AudioManager.Instance.Initialize(Content); // Now load the sprite creator factory helper factory = GameObjectFactory.Instance; factory.Initialize(textureManager); cannonManager = new CannonManager(); cannonGroups = new List <CannonGroups>(); client = new ClientNetworking(); client.Connect(); client.ActionHandler["shoot"] = new EventHandler(this.HandleNetworkShoot); client.ActionHandler["create"] = new EventHandler(this.HandleNetworkCreate); client.ActionHandler["plane"] = new EventHandler(this.HandleNetworkPlane); client.ActionHandler["createother"] = new EventHandler(this.HandleNetworkCreateOtherStuff); client.ActionHandler["reset"] = new EventHandler(this.HandleReset); client.ActionHandler["endgame"] = new EventHandler(this.HandleEndGame); client.ActionHandler["sendpoints"] = new EventHandler(this.HandleSendPoints); // Add a few sprite creators factory.AddCreator((int)GameObjectTypes.CAT, SpriteCreators.CreateCat); factory.AddCreator((int)GameObjectTypes.DOG, SpriteCreators.CreateDog); factory.AddCreator((int)GameObjectTypes.SUN, SpriteCreators.CreateSun); factory.AddCreator((int)GameObjectTypes.BOOM, SpriteCreators.CreateBoom); factory.AddCreator((int)GameObjectTypes.PUFF, SpriteCreators.CreatePuff); factory.AddCreator((int)GameObjectTypes.DINO, SpriteCreators.CreateDino); factory.AddCreator((int)GameObjectTypes.CLOUD1, SpriteCreators.CreateCloud1); factory.AddCreator((int)GameObjectTypes.CLOUD2, SpriteCreators.CreateCloud2); factory.AddCreator((int)GameObjectTypes.CLOUD3, SpriteCreators.CreateCloud3); factory.AddCreator((int)GameObjectTypes.CLOUD4, SpriteCreators.CreateCloud4); factory.AddCreator((int)GameObjectTypes.CLOUD5, SpriteCreators.CreateCloud5); factory.AddCreator((int)GameObjectTypes.CLOUD6, SpriteCreators.CreateCloud6); factory.AddCreator((int)GameObjectTypes.WOOD1, SpriteCreators.CreateWood1); factory.AddCreator((int)GameObjectTypes.WOOD2, SpriteCreators.CreateWood2); factory.AddCreator((int)GameObjectTypes.WOOD3, SpriteCreators.CreateWood3); factory.AddCreator((int)GameObjectTypes.WOOD4, SpriteCreators.CreateWood4); factory.AddCreator((int)GameObjectTypes.PLATFORM_LEFT, SpriteCreators.CreatePlatformLeft); factory.AddCreator((int)GameObjectTypes.PLATFORM_MIDDLE, SpriteCreators.CreatePlatformMiddle); factory.AddCreator((int)GameObjectTypes.PLATFORM_RIGHT, SpriteCreators.CreatePlatformRight); factory.AddCreator((int)GameObjectTypes.CANNON, SpriteCreators.CreateCannon); factory.AddCreator((int)GameObjectTypes.CANNONWHEEL, SpriteCreators.CreateCannonWheel); factory.AddCreator((int)GameObjectTypes.POWERMETERBAR, SpriteCreators.CreatePowerMeterBar); factory.AddCreator((int)GameObjectTypes.POWERMETERTAB, SpriteCreators.CreatePowerMeterTab); factory.AddCreator((int)GameObjectTypes.EXPLOSION1, SpriteCreators.CreateExplosion1); factory.AddCreator((int)GameObjectTypes.EXPLOSION1, SpriteCreators.CreateExplosion2); factory.AddCreator((int)GameObjectTypes.PLANE, SpriteCreators.CreatePlane); factory.AddCreator((int)GameObjectTypes.CATSPLODE, SpriteCreators.CreateCatsplode); factory.AddCreator((int)GameObjectTypes.DUSTSPLODE, SpriteCreators.CreateDustsplode); factory.AddCreator((int)GameObjectTypes.YOULOSE, SpriteCreators.CreateYouLose); factory.AddCreator((int)GameObjectTypes.YOUWIN, SpriteCreators.CreateYouWin); factory.AddCreator((int)GameObjectTypes.SCOREPLUS50, SpriteCreators.CreatePlus50); factory.AddCreator((int)GameObjectTypes.SCOREPLUS100, SpriteCreators.CreatePlus100); factory.AddCreator((int)GameObjectTypes.SCOREPLUS250, SpriteCreators.CreatePlus250); //factory.AddCreator((int)GameObjectTypes.EAHSCSLOGO, SpriteCreators.CreateEAHSCSLogo); mapEditor = new MapEditor(Window, client, cannonManager, cannonGroups, ScreenConfiguration); base.Initialize(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here GameWorld.Initialize(0, 12234 - ( 1080 * 2), this.Window.ClientBounds.Width, this.Window.ClientBounds.Height, new Vector2(0, 9.8f)); GameWorld.ViewPortXOffset = 0; SpriteCreators.Load("Content\\spritesheet.txt"); MapLoaded = false; // Create the texture manager textureManager = new TextureManager(Content); //Create the audio manager AudioManager.Instance.Initialize(Content); // Now load the sprite creator factory helper factory = GameObjectFactory.Instance; factory.Initialize(textureManager); cannonManager = new CannonManager(); cannonGroups = new List<CannonGroups>(); client = new ClientNetworking(); client.Connect(); client.ActionHandler["shoot"] = new EventHandler(this.HandleNetworkShoot); client.ActionHandler["create"] = new EventHandler(this.HandleNetworkCreate); client.ActionHandler["plane"] = new EventHandler(this.HandleNetworkPlane); client.ActionHandler["createother"] = new EventHandler(this.HandleNetworkCreateOtherStuff); client.ActionHandler["reset"] = new EventHandler(this.HandleReset); client.ActionHandler["endgame"] = new EventHandler(this.HandleEndGame); client.ActionHandler["sendpoints"] = new EventHandler(this.HandleSendPoints); // Add a few sprite creators factory.AddCreator((int)GameObjectTypes.CAT, SpriteCreators.CreateCat); factory.AddCreator((int)GameObjectTypes.DOG, SpriteCreators.CreateDog); factory.AddCreator((int)GameObjectTypes.SUN, SpriteCreators.CreateSun); factory.AddCreator((int)GameObjectTypes.BOOM, SpriteCreators.CreateBoom); factory.AddCreator((int)GameObjectTypes.PUFF, SpriteCreators.CreatePuff); factory.AddCreator((int)GameObjectTypes.DINO, SpriteCreators.CreateDino); factory.AddCreator((int)GameObjectTypes.CLOUD1, SpriteCreators.CreateCloud1); factory.AddCreator((int)GameObjectTypes.CLOUD2, SpriteCreators.CreateCloud2); factory.AddCreator((int)GameObjectTypes.CLOUD3, SpriteCreators.CreateCloud3); factory.AddCreator((int)GameObjectTypes.CLOUD4, SpriteCreators.CreateCloud4); factory.AddCreator((int)GameObjectTypes.CLOUD5, SpriteCreators.CreateCloud5); factory.AddCreator((int)GameObjectTypes.CLOUD6, SpriteCreators.CreateCloud6); factory.AddCreator((int)GameObjectTypes.WOOD1, SpriteCreators.CreateWood1); factory.AddCreator((int)GameObjectTypes.WOOD2, SpriteCreators.CreateWood2); factory.AddCreator((int)GameObjectTypes.WOOD3, SpriteCreators.CreateWood3); factory.AddCreator((int)GameObjectTypes.WOOD4, SpriteCreators.CreateWood4); factory.AddCreator((int)GameObjectTypes.PLATFORM_LEFT, SpriteCreators.CreatePlatformLeft); factory.AddCreator((int)GameObjectTypes.PLATFORM_MIDDLE, SpriteCreators.CreatePlatformMiddle); factory.AddCreator((int)GameObjectTypes.PLATFORM_RIGHT, SpriteCreators.CreatePlatformRight); factory.AddCreator((int)GameObjectTypes.CANNON, SpriteCreators.CreateCannon); factory.AddCreator((int)GameObjectTypes.CANNONWHEEL, SpriteCreators.CreateCannonWheel); factory.AddCreator((int)GameObjectTypes.POWERMETERBAR, SpriteCreators.CreatePowerMeterBar); factory.AddCreator((int)GameObjectTypes.POWERMETERTAB, SpriteCreators.CreatePowerMeterTab); factory.AddCreator((int)GameObjectTypes.EXPLOSION1, SpriteCreators.CreateExplosion1); factory.AddCreator((int)GameObjectTypes.EXPLOSION1, SpriteCreators.CreateExplosion2); factory.AddCreator((int)GameObjectTypes.PLANE, SpriteCreators.CreatePlane); factory.AddCreator((int)GameObjectTypes.CATSPLODE, SpriteCreators.CreateCatsplode); factory.AddCreator((int)GameObjectTypes.DUSTSPLODE, SpriteCreators.CreateDustsplode); factory.AddCreator((int)GameObjectTypes.YOULOSE, SpriteCreators.CreateYouLose); factory.AddCreator((int)GameObjectTypes.YOUWIN, SpriteCreators.CreateYouWin); factory.AddCreator((int)GameObjectTypes.SCOREPLUS50, SpriteCreators.CreatePlus50); factory.AddCreator((int)GameObjectTypes.SCOREPLUS100, SpriteCreators.CreatePlus100); factory.AddCreator((int)GameObjectTypes.SCOREPLUS250, SpriteCreators.CreatePlus250); //factory.AddCreator((int)GameObjectTypes.EAHSCSLOGO, SpriteCreators.CreateEAHSCSLogo); mapEditor = new MapEditor(Window, client, cannonManager, cannonGroups, ScreenConfiguration); base.Initialize(); }