Updated stardust core animation manager to have proper play animation function. Also added in junimo walking animations.
This commit is contained in:
parent
054077e94d
commit
a75503637d
|
@ -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<Animation>()
|
||||
{
|
||||
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<Animation>()
|
||||
{
|
||||
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<Animation>()
|
||||
{
|
||||
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<Animation>()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,41 @@ namespace StardustCore.Animations
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the animation from the dictionary of all animations available.</summary>
|
||||
/// <param name="AnimationName"></param>
|
||||
/// <param name="StartingFrame"></param>
|
||||
public bool playAnimation(string AnimationName,bool overrideSameAnimation=false,int StartingFrame = 0)
|
||||
{
|
||||
if (this.animations.TryGetValue(AnimationName, out List<Animation> 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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the animation manager to an on state, meaning that this animation will update on the draw frame.</summary>
|
||||
public void enableAnimation()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue