diff --git a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCPlayer.cs b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCPlayer.cs index fddf869b..a6ab92d5 100644 --- a/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCPlayer.cs +++ b/GeneralMods/Revitalize/Framework/Minigame/SeasideScrambleMinigame/SSCPlayer.cs @@ -18,6 +18,8 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame public Microsoft.Xna.Framework.Vector2 position; public bool isMoving; + public const int junimoWalkingAnimationSpeed = 10; + public SSCPlayer() { this.facingDirection = SSCEnums.FacingDirection.Down; @@ -38,6 +40,51 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame { new Animation(0,16*3,16,16) } }, + {"Walking_F",new List() + { + new Animation(16*0,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*1,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*2,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*3,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*4,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*5,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*6,16*0,16,16,junimoWalkingAnimationSpeed), + new Animation(16*7,16*0,16,16,junimoWalkingAnimationSpeed), + } }, + {"Walking_R",new List() + { + new Animation(16*0,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*1,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*2,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*3,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*4,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*5,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*6,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*7,16*2,16,16,junimoWalkingAnimationSpeed), + } }, + {"Walking_L",new List() + { + new Animation(16*0,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*1,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*2,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*3,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*4,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*5,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*6,16*2,16,16,junimoWalkingAnimationSpeed), + new Animation(16*7,16*2,16,16,junimoWalkingAnimationSpeed), + } }, + {"Walking_B",new List() + { + new Animation(16*0,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*1,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*2,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*3,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*4,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*5,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*6,16*4,16,16,junimoWalkingAnimationSpeed), + new Animation(16*7,16*4,16,16,junimoWalkingAnimationSpeed), + } }, + @@ -60,21 +107,21 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame { if(this.facingDirection== SSCEnums.FacingDirection.Down) { - this.characterSpriteController.setAnimation("Idle_F"); + this.characterSpriteController.playAnimation("Idle_F"); } if (this.facingDirection == SSCEnums.FacingDirection.Right) { - this.characterSpriteController.setAnimation("Idle_R"); + this.characterSpriteController.playAnimation("Idle_R"); } if (this.facingDirection == SSCEnums.FacingDirection.Left) { - this.characterSpriteController.setAnimation("Idle_L"); + this.characterSpriteController.playAnimation("Idle_L"); this.flipSprite = true; return; } if (this.facingDirection == SSCEnums.FacingDirection.Up) { - this.characterSpriteController.setAnimation("Idle_B"); + this.characterSpriteController.playAnimation("Idle_B"); } this.flipSprite = false; } @@ -82,21 +129,21 @@ namespace Revitalize.Framework.Minigame.SeasideScrambleMinigame { if (this.facingDirection == SSCEnums.FacingDirection.Down) { - this.characterSpriteController.setAnimation("Idle_F"); + this.characterSpriteController.playAnimation("Walking_F"); } if (this.facingDirection == SSCEnums.FacingDirection.Right) { - this.characterSpriteController.setAnimation("Idle_R"); + this.characterSpriteController.playAnimation("Walking_R"); } if (this.facingDirection == SSCEnums.FacingDirection.Left) { - this.characterSpriteController.setAnimation("Idle_L"); + this.characterSpriteController.playAnimation("Walking_L"); this.flipSprite = true; return; } if (this.facingDirection == SSCEnums.FacingDirection.Up) { - this.characterSpriteController.setAnimation("Idle_B"); + this.characterSpriteController.playAnimation("Walking_B"); } this.flipSprite = false; } diff --git a/GeneralMods/StardustCore/Animations/AnimationManager.cs b/GeneralMods/StardustCore/Animations/AnimationManager.cs index f642d62a..a8c76f3e 100644 --- a/GeneralMods/StardustCore/Animations/AnimationManager.cs +++ b/GeneralMods/StardustCore/Animations/AnimationManager.cs @@ -137,6 +137,41 @@ namespace StardustCore.Animations } } + /// Gets the animation from the dictionary of all animations available. + /// + /// + public bool playAnimation(string AnimationName,bool overrideSameAnimation=false,int StartingFrame = 0) + { + if (this.animations.TryGetValue(AnimationName, out List dummyList)) + { + if (overrideSameAnimation == false) + { + if (this.currentAnimationName == AnimationName) return true; + } + if (dummyList.Count != 0 || StartingFrame >= dummyList.Count) + { + this.currentAnimationList = dummyList; + this.currentAnimation = this.currentAnimationList[StartingFrame]; + this.currentAnimationName = AnimationName; + this.currentAnimation.startAnimation(); + return true; + } + else + { + if (dummyList.Count == 0) + ModCore.ModMonitor.Log("Error: Current animation " + AnimationName + " has no animation frames associated with it."); + if (dummyList.Count > dummyList.Count) + ModCore.ModMonitor.Log("Error: Animation frame " + StartingFrame + " is outside the range of provided animations. Which has a maximum count of " + dummyList.Count); + return false; + } + } + else + { + ModCore.ModMonitor.Log("Error setting animation: " + AnimationName + " animation does not exist in list of available animations. Did you make sure to add it in?"); + return false; + } + } + /// Sets the animation manager to an on state, meaning that this animation will update on the draw frame. public void enableAnimation() {