private void sendUndergroundAnimation(IPlayer mario, float elapsedtime) { if (transitiontime > UtilityClass.zero) { if (transitiontime < UtilityClass.two && transitiontime > UtilityClass.pipeTransistionAnimationSecondFramTime) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeBelowGroundTransistionX, UtilityClass.pipeSendBelowGroundTransistionOneY); } if (transitiontime < UtilityClass.pipeTransistionAnimationSecondFramTime && transitiontime > UtilityClass.one) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeBelowGroundTransistionX, UtilityClass.pipeSendBelowGroundTransistionTwoY); } if (transitiontime < UtilityClass.one && transitiontime > UtilityClass.pipeTransistionAnimationFourthFrameTime) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeBelowGroundTransistionX, UtilityClass.pipeSendBelowGroundTransistionThreeY); } if (transitiontime < UtilityClass.pipeTransistionAnimationFourthFrameTime && transitiontime > UtilityClass.zero) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeBelowGroundTransistionX, UtilityClass.pipeSendBelowGroundTransistionFourY); } transitiontime = transitiontime - elapsedtime; } else { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendBelowMarioX, UtilityClass.pipeSendBelowMarioY); transitiontime = UtilityClass.two; hasbeguntransition = false; MusicFactory.UnderworldTheme(); } }
private void sendAboveGroundTransistion(IPlayer mario, float elapsedtime, Camera camera) { if (transitiontime > UtilityClass.zero) { if (transitiontime < UtilityClass.two && transitiontime > UtilityClass.pipeTransistionAnimationSecondFramTime) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundTransistionOneX, UtilityClass.sendAbovegroundYLocation); } if (transitiontime < UtilityClass.pipeTransistionAnimationSecondFramTime && transitiontime > UtilityClass.one) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundTransistionTwoX, UtilityClass.sendAbovegroundYLocation); } if (transitiontime < UtilityClass.one && transitiontime > UtilityClass.pipeTransistionAnimationFourthFrameTime) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundTransistionThreeX, UtilityClass.sendAbovegroundYLocation); } if (transitiontime < UtilityClass.pipeTransistionAnimationFourthFrameTime && transitiontime > UtilityClass.zero) { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundTransistionFourX, UtilityClass.sendAbovegroundYLocation); } transitiontime = transitiontime - elapsedtime; } else { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundFinishedMarioLocationX, UtilityClass.pipeSendAboveGroundFinishedMarioLocationY); camera.MoveLeft(UtilityClass.pipeSendAboveCameraAdjustment); transitiontime = UtilityClass.two; hasbeguntransitionout = false; MusicFactory.MainTheme(); } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); BlockSpriteTextureStorage.Load(this.Content); ItemSpriteTextureStorage.Load(this.Content); EnemySpriteFactory.Load(this.Content); MiscGameObjectTextureStorage.Load(this.Content); MarioSpriteFactory.Load(this.Content); GUISpriteFactory.Load(this.Content); SoundEffectFactory.Load(this.Content); MusicFactory.Load(this.Content); background = Content.Load <Texture2D>(UtilityClass.background); background2 = Content.Load <Texture2D>(UtilityClass.background2); skyworldbackground = Content.Load <Texture2D>("skyworldbackground"); deathbackground = Content.Load <Texture2D>(UtilityClass.deathbackground); font = Content.Load <SpriteFont>(UtilityClass.FontString); basicarialfont = Content.Load <SpriteFont>(UtilityClass.BasicArialFontString); LoadKeyBoardCommands(); levelStore = loader.LoadLevel(); mario = levelStore.player; cameraController = new CameraController(camera, mario); resetCommand = new ResetLevelCommand(this); MusicFactory.MainTheme(); ResetGui(); }
public void Update(Mario mario, float elapsedtime, Game1 game) { if (((Mario)mario).StateStatus().Equals(MarioState.Die)) { if (playmusic) { MusicFactory.Dead(); while (MediaPlayer.State != MediaState.Stopped) { } playmusic = false; } while (MediaPlayer.State != MediaState.Stopped) { } if (((Mario)mario).GetLives().ScoreValue < UtilityClass.zero) { MusicFactory.GameOver(); } if (deathtime > UtilityClass.zero) { deathscreen = true; deathtime = deathtime - elapsedtime; } else { deathscreen = false; game.resetCommand.Execute(); playmusic = true; deathtime = UtilityClass.deathTimer; } } else if (((int)(((Mario)mario).Location.Y)) > game.camera.GetHeight()) { ((Mario)mario).DieImmediately(); if (playmusic) { MusicFactory.Dead(); while (MediaPlayer.State != MediaState.Stopped) { } playmusic = false; } if (((Mario)mario).GetLives().ScoreValue < UtilityClass.zero) { MusicFactory.GameOver(); } if (deathtime > UtilityClass.zero) { deathscreen = true; deathtime = deathtime - elapsedtime; } else { deathscreen = false; game.resetCommand.Execute(); playmusic = true; deathtime = UtilityClass.deathTimer; } } }
private void SendFromSkyWorld(Mario mario, float elapsedtime, Game1 game) { if (transitiontime > UtilityClass.zero) { if (transitiontime < UtilityClass.two && transitiontime > UtilityClass.pipeTransistionAnimationSecondFramTime) { ((Mario)mario).Location = new Vector2(UtilityClass.MarioSkyWorldExitPipeLocationX, UtilityClass.pipeSendBelowGroundTransistionOneY + 35); } if (transitiontime < UtilityClass.pipeTransistionAnimationSecondFramTime && transitiontime > UtilityClass.one) { ((Mario)mario).Location = new Vector2(UtilityClass.MarioSkyWorldExitPipeLocationX, UtilityClass.pipeSendBelowGroundTransistionTwoY + 35); } if (transitiontime < UtilityClass.one && transitiontime > UtilityClass.pipeTransistionAnimationFourthFrameTime) { ((Mario)mario).Location = new Vector2(UtilityClass.MarioSkyWorldExitPipeLocationX, UtilityClass.pipeSendBelowGroundTransistionThreeY + 35); } if (transitiontime < UtilityClass.pipeTransistionAnimationFourthFrameTime && transitiontime > UtilityClass.zero) { ((Mario)mario).Location = new Vector2(UtilityClass.MarioSkyWorldExitPipeLocationX, UtilityClass.pipeSendBelowGroundTransistionFourY + 35); } transitiontime = transitiontime - elapsedtime; } else { ((Mario)mario).Location = new Vector2(UtilityClass.pipeSendAboveGroundFinishedMarioLocationX, 0); game.camera.MoveLeft(UtilityClass.MarioSkyWorldCameraAdjustmentForExit); transitiontime = UtilityClass.two; MusicFactory.MainTheme(); } }
public void Update(GameTime time) { RegisterConditionTime(time); if (Math.Abs(rigidbody.Velocity.Y) > UtilityClass.zero) { State.Jump(); } else if (rigidbody.Floored) { points.ResetChain(); if (Math.Abs(rigidbody.Velocity.X) > UtilityClass.marioMinMovementSpeed) { State.Running(); } else if (!StateStatus().Equals(MarioState.Duck)) { State.Still(); } } if ((FacingRight && rigidbody.Velocity.X < UtilityClass.zero) || (!FacingRight && rigidbody.Velocity.X > UtilityClass.zero)) { FacingRight = !FacingRight; ChangeDirection(); } if (!transitioning) { rigidbody.UpdatePhysics(); Location += rigidbody.Velocity; } if (!Star) { State.Update(); } else { if (timer == UtilityClass.marioStarTimer) { MusicFactory.StarMan(); } if (timer == UtilityClass.zero) { Star = false; timer = UtilityClass.marioStarTimer; MusicFactory.MainTheme(); } timer--; State.Update(); } }