public void ReLoadLevel() { lives--; gameObjects.Clear(); if (level == ConstantNumber.LEVEL_1) { LevelLoader.LoadLevel(gameObjects, @"level.csv"); } else if (level == ConstantNumber.LEVEL_2) { LevelLoader.LoadLevel(gameObjects, @"hardlevel.csv"); } else if (level == ConstantNumber.LEVEL_3) { ReLoadMenu(); } collisionInvoker = new CollisionInvoker(mario); SoundFactory.Instance.playThemeSong(); flagpoleEffectPlayed = false; if (levelSelected) { keyboardController.ClearCommand(); LoadGamePlayingCommand(); } HUD.Reset(); }
public void LoadOvergroundLevel() { gameObjects.Clear(); LevelLoader.ChangeLevel(gameObjects, @"levelp2.csv"); collisionInvoker = new CollisionInvoker(mario); backgroundColor = Color.CornflowerBlue; SoundFactory.Instance.playThemeSong(); keyboardController.ClearCommand(); LoadGamePlayingCommand(); mario.state.ToUp(); mario.physics.ApplyForce(new Vector2(0, ConstantNumber.MARIO_JUMPING_FORCE_Y)); }
public void LoadUndergroundLevel() { gameObjects.Clear(); LevelLoader.ChangeLevel(gameObjects, @"underground.csv"); collisionInvoker = new CollisionInvoker(mario); backgroundColor = Color.Black; SoundFactory.Instance.playUndergroundSong(); keyboardController.ClearCommand(); LoadGamePlayingCommand(); mario.state.ToUp(); mario.physics.ApplyForce(new Vector2(0, 4.5f)); }
public void Select() { levelSelected = true; if (level == ConstantNumber.LEVEL_1) { LevelLoader.LoadLevel(gameObjects, @"level.csv"); keyboardController.ClearCommand(); LoadGamePlayingCommand(); } else if (level == ConstantNumber.LEVEL_2) { LevelLoader.LoadLevel(gameObjects, @"hardlevel.csv"); keyboardController.ClearCommand(); LoadGamePlayingCommand(); } else if (level == ConstantNumber.LEVEL_3) { LevelLoader.LoadLevel(gameObjects, @"pkLevel.csv"); keyboardController.ClearCommand(); isPkMode = true; LoadGamePlayingCommand(); luigi.Evolve(); } else if (level == ConstantNumber.LEVEL_4) { Exit(); } backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(600, 100))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(100, 100))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(300, 300))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(2600, 100))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(2100, 50))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCloud(new Vector2(1300, 80))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateBush(new Vector2(1200, 435))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateBush(new Vector2(100, 435))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateBush(new Vector2(200, 435))); backgroundList.Add(BackgroundSpriteFactory.Instance.CreateCastle(new Vector2(3200, 366))); if (isPkMode) { marioHealthBar = BackgroundSpriteFactory.Instance.CreateHealthBar(new Vector2(ConstantNumber.MARIO_HEALTH_BAR_X, ConstantNumber.MARIO_HEALTH_BAR_Y)); luigiHealthBar = BackgroundSpriteFactory.Instance.CreateHealthBar(new Vector2(ConstantNumber.LUIGI_HEALTH_BAR_X, ConstantNumber.LUIGI_HEALTH_BAR_Y)); mario.Evolve(); } HUD = new HeadsUpDisplay(this, Content); collisionInvoker = new CollisionInvoker(mario); }
public void ReLoadGame() { backgroundColor = Color.CornflowerBlue; gameObjects.Clear(); ReLoadMenu(); Camera.Instance.ResetCameraLocation(); collisionInvoker = new CollisionInvoker(mario); SoundFactory.Instance.playThemeSong(); gameoverSoundPlayed = false; flagpoleEffectPlayed = false; if (levelSelected) { keyboardController.ClearCommand(); LoadGamePlayingCommand(); } HUD.Reset(); lives = ConstantNumber.LIVES_INIT; mario.health = ConstantNumber.MARIO_HEALTH; if (isPkMode) { luigi.health = ConstantNumber.MARIO_HEALTH; } }