/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); #region Load Textures MarioSpriteFactory.Instance.LoadAllTextures(Content); EnemySpriteFactory.Instance.LoadAllTextures(Content); ItemSpriteFactory.Instance.LoadAllTextures(Content); BlockSpriteFactory.Instance.LoadAllTextures(Content); FireballSpriteFactory.Instance.LoadAllTextures(Content); BackgroundSpriteFactory.Instance.LoadAllTextures(Content); PipeSpriteFactory.Instance.LoadAllTextures(Content); SoundManager.Instance.LoadAllSounds(Content); TextSpriteFactory.Instance.LoadAllTextures(Content); #endregion Vector2 location = new Vector2(50, 200); Mario = new MarioObject(location); objectManager = new GameObjectManager(this, Mario); gamedata = new GameData(objectManager); camera1 = new Camera(); Camera.LimitationList.Add(3600); camera2 = new Camera2D(GraphicsDevice.Viewport); blackbackground = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); LevelLoader loader = new LevelLoader(objectManager, Mario); loader.Load(); keyboard = new KeyboardControls(this, Mario); gamepad = new GamePadControls(this, Mario); }
public void LevelReset() { Vector2 restartPoint = GameObjectManager.restartPoint; spriteBatch = new SpriteBatch(GraphicsDevice); #region Load Textures MarioSpriteFactory.Instance.LoadAllTextures(Content); EnemySpriteFactory.Instance.LoadAllTextures(Content); ItemSpriteFactory.Instance.LoadAllTextures(Content); BlockSpriteFactory.Instance.LoadAllTextures(Content); FireballSpriteFactory.Instance.LoadAllTextures(Content); BackgroundSpriteFactory.Instance.LoadAllTextures(Content); PipeSpriteFactory.Instance.LoadAllTextures(Content); SoundManager.Instance.LoadAllSounds(Content); TextSpriteFactory.Instance.LoadAllTextures(Content); #endregion Mario = new MarioObject(restartPoint); objectManager = new GameObjectManager(this, Mario); gamedata = new GameData(objectManager); camera1 = new Camera(); Camera.LimitationList.Add(3600); camera2 = new Camera2D(GraphicsDevice.Viewport); blackbackground = BackgroundSpriteFactory.Instance.CreateBlackBackgroundSprite(); LevelLoader loader = new LevelLoader(objectManager, Mario); loader.Load(); keyboard = new KeyboardControls(this, Mario); gamepad = new GamePadControls(this, Mario); Camera.SetCamera(new Vector2(restartPoint.X - 16 * 5, 0)); MarioInfo.ClearTimer(); MarioInfo.ResetTimer(); MarioInfo.StartTimer(); }
public ObjSlotManager(List <Input> inputs) { GlobalTimer = Config.Stream.GetInt(MiscConfig.GlobalTimerAddress); WaterLevelIndex = WaterLevelCalculator.GetWaterLevelIndex(); WaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(WaterLevelIndex); FutureWaterLevelIndex = WaterLevelCalculator.GetWaterLevelIndex() + 1; FutureWaterLevel = WaterLevelCalculator.GetWaterLevelFromIndex(FutureWaterLevelIndex); YorangeObjects = new List <WaterObject>(); GreenObjects = new List <WaterObject>(); PurpleObjects = new List <WaterObject>(); BrownObjects = new List <WaterObject>(); ObjectLists = new List <List <WaterObject> >() { YorangeObjects, GreenObjects, PurpleObjects, BrownObjects, }; Rng = new TtcRng(); MarioObject marioObject = new MarioObject(this, Rng, inputs); YorangeObjects.Add(marioObject); List <ObjectDataModel> bobombBuddyObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bob-omb Buddy (Opens Cannon)"); foreach (var bobombBuddyObj in bobombBuddyObjs) { int blinkingTimer = Config.Stream.GetInt(bobombBuddyObj.Address + 0xF4); BobombBuddyObject bobombBuddyObject = new BobombBuddyObject(this, Rng, blinkingTimer); GreenObjects.Add(bobombBuddyObject); } List <ObjectDataModel> bubbleSpawnerObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Bubble Spawner"); foreach (var bubbleSpawnerObj in bubbleSpawnerObjs) { float y = Config.Stream.GetFloat(bubbleSpawnerObj.Address + ObjectConfig.YOffset); int timer = Config.Stream.GetInt(bubbleSpawnerObj.Address + ObjectConfig.TimerOffset); int timerMax = Config.Stream.GetInt(bubbleSpawnerObj.Address + 0xF4); BubbleSpawnerObject bubbleSpawnerObject = new BubbleSpawnerObject(this, Rng, y, timer, timerMax); PurpleObjects.Add(bubbleSpawnerObject); } List <ObjectDataModel> bubbleObjs = Config.ObjectSlotsManager.GetLoadedObjectsWithName("Underwater Bubble"); foreach (var bubbleObj in bubbleObjs) { float y = Config.Stream.GetFloat(bubbleObj.Address + ObjectConfig.YOffset); int timer = Config.Stream.GetInt(bubbleObj.Address + ObjectConfig.TimerOffset); float varF4 = Config.Stream.GetFloat(bubbleObj.Address + 0xF4); float varF8 = Config.Stream.GetFloat(bubbleObj.Address + 0xF8); float varFC = Config.Stream.GetFloat(bubbleObj.Address + 0xFC); float var100 = Config.Stream.GetFloat(bubbleObj.Address + 0x100); BubbleObject bubbleObject = new BubbleObject(this, Rng, y, timer, varF4, varF8, varFC, var100); BrownObjects.Add(bubbleObject); } }
public PiranhaPlants(Vector2 location, MarioObject Mario) { sprite = ItemSpriteFactory.Instance.CreatePiranhaPlantsSprite(); Location = location; initialLocation = location; Destination = sprite.MakeDestinationRectangle(Location); Velocity = new Vector2(0, -0.2f); mario = Mario; }
public void MarioQuestionBlockRightCollision() { TestGame = new MarioGame(); TestWorld = TestGame.World; Content = TestGame.Content; TestMario = TestGame.World.Mario; //TestBlock = TestGame.World.QuestionBlockObject; TestCommand = new MarioRightCommand(TestGame); TestMario.PassCommand(TestCommand); //Check that question block is not changed //Assert.AreEqual(QuestionBlockSpriteState, TestBlock.SpriteState); }
public void MarioQuestionBlockBottomCollision() { TestGame = new MarioGame(); TestWorld = TestGame.World; Content = TestGame.Content; TestMario = TestGame.World.Mario; //TestBlock = TestGame.World.QuestionBlockObject; TestCommand = new MarioUpCommand(TestGame); TestMario.PassCommand(TestCommand); //Check that question block is now used block //Assert.AreEqual(UsedBlockSpriteState, TestBlock.SpriteState); }
public void MarioGoombaBottomCollision() { TestGame = new MarioGame(); TestWorld = TestGame.World; Content = TestGame.Content; TestMario = TestGame.World.Mario; TestGoomba = TestGame.World.Goomba; TestCommand = new MarioUpCommand(TestGame); TestMario.PassCommand(TestCommand); //Check if Mario is dead //Assert.AreEqual(true, TestMario.SpriteState.IsDead()); //Check if Goomba is dead //Assert.AreEqual(GoombaSprite, TestGoomba.SpriteState); }
public void MarioKoopaBottomCollision() { TestGame = new MarioGame(); TestWorld = TestGame.World; Content = TestGame.Content; TestMario = TestGame.World.Mario; TestKoopa = TestGame.World.Koopa; TestCommand = new MarioUpCommand(TestGame); TestMario.PassCommand(TestCommand); //Check if Mario is dead Assert.AreEqual(true, TestMario.Alive); //Check if Koopa is Shell //Assert.AreEqual("WalkingKoopaSprite", TestKoopa.SpriteState); }
public void MarioKoopaTopCollision() { TestGame = new MarioGame(); TestWorld = TestGame.World; Content = TestGame.Content; TestMario = TestGame.World.Mario; TestKoopa = TestGame.World.Koopa; TestCommand = new MarioDownCommand(TestGame); TestMario.PassCommand(TestCommand); //Check if Mario is alive Assert.AreEqual(false, TestMario.Alive); //Check if Koopa is Shell //Assert.AreEqual("ShellKoopaSprite", TestKoopa.SpriteState); }
public LevelLoader(GameObjectManager gameManager, MarioObject Mario) { objectMagager = gameManager; mario = Mario; }