public override void LoadAnimations() { base.LoadAnimations(); Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Enemies/Paratroopa.png"); AnimManager.SetSpriteSheet(spriteSheet); //The Paratroopa uses the same in shell animation as a Koopa Troopa for Shell Shot, but rotates itself differently AnimManager.AddAnimation(AnimationGlobals.ParatroopaBattleAnimations.ShellShotName, new Animation(spriteSheet, new Animation.Frame(new Rectangle(2, 222, 28, 25), 1000d))); LoopAnimation wingedIdle = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop, new Animation.Frame(new Rectangle(56, 4, 32, 48), 100d), new Animation.Frame(new Rectangle(56, 4, 32, 48), 100d, new Vector2(0, -1)), new Animation.Frame(new Rectangle(56, 4, 32, 48), 100d, new Vector2(0, -2)), new Animation.Frame(new Rectangle(56, 4, 32, 48), 100d, new Vector2(0, -1))); //This animation uses the same rectangle for every frame. However, the wings are different on those frames and the //Paratroopa has varying heights on each frame AnimManager.AddAnimation(AnimationGlobals.WingedBattleAnimations.WingedIdleName, wingedIdle); wingedIdle.SetChildFrames( new Animation.Frame(new Rectangle(72, 156, 19, 27), 100d, new Vector2(19, -13)), new Animation.Frame(new Rectangle(104, 220, 23, 23), 100d, new Vector2(21, -8)), new Animation.Frame(new Rectangle(40, 219, 18, 28), 100d, new Vector2(19, 8)), new Animation.Frame(new Rectangle(248, 190, 21, 23), 100d, new Vector2(20, 1))); //NOTE: Incomplete wing frames; the wings on the left of the Paratroopa will require more work to get in due to the way the wings are stored //Same story with this one LoopAnimation flyingName = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop, new Animation.Frame(new Rectangle(103, 4, 33, 51), 80d), new Animation.Frame(new Rectangle(103, 4, 33, 51), 80d, new Vector2(0, -1)), new Animation.Frame(new Rectangle(103, 4, 33, 51), 80d, new Vector2(0, -2)), new Animation.Frame(new Rectangle(103, 4, 33, 51), 80d, new Vector2(0, -1))); AnimManager.AddAnimation(AnimationGlobals.WingedBattleAnimations.FlyingName, flyingName); flyingName.SetChildFrames( new Animation.Frame(new Rectangle(72, 156, 19, 27), 80d, new Vector2(26, -4)), new Animation.Frame(new Rectangle(104, 220, 23, 23), 80d, new Vector2(26, 4)), new Animation.Frame(new Rectangle(40, 219, 18, 28), 80d, new Vector2(26, 16)), new Animation.Frame(new Rectangle(248, 190, 21, 23), 80d, new Vector2(26, 13))); Animation hurtName = new Animation(spriteSheet, new Animation.Frame(new Rectangle(5, 59, 39, 44), 250d), new Animation.Frame(new Rectangle(200, 3, 36, 43), 250d)); AnimManager.AddAnimation(AnimationGlobals.HurtName, hurtName); //NOTE: Not accurate - in PM, it looks like the wings are rotated slightly to match the Paratroopa's pose in its hurt animation hurtName.SetChildFrames( new Animation.Frame(new Rectangle(66, 190, 45, 26), 250d, new Vector2(3, -6), -.01f), new Animation.Frame(new Rectangle(66, 190, 45, 26), 250d, new Vector2(3, -6), -.01f)); }
/// <summary> /// Sets the child frames for an animation to render. /// </summary> /// <param name="animName">The name of the animation.</param> /// <param name="frames">The Frames to set as the Animation's child frames.</param> public void AddAnimationChildFrames(string animName, params Animation.Frame[] frames) { Animation anim = GetAnimation(animName); //The error message is in the previous method so simply return if (anim == null) { return; } anim.SetChildFrames(frames); }
public override void LoadAnimations() { base.LoadAnimations(); Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Enemies/Paragoomba.png"); AnimManager.SetSpriteSheet(spriteSheet); LoopAnimation wingedIdle = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop, new Animation.Frame(new Rectangle(129, 45, 27, 28), 200d), new Animation.Frame(new Rectangle(1, 7, 27, 30), 200d, new Vector2(0, 1))); LoopAnimation flyingName = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop, new Animation.Frame(new Rectangle(129, 45, 27, 28), 100d), new Animation.Frame(new Rectangle(1, 7, 27, 30), 100d)); Animation hurtName = new Animation(spriteSheet, new Animation.Frame(new Rectangle(97, 48, 29, 27), 80d), new Animation.Frame(new Rectangle(98, 89, 27, 26), 80d)); Animation deathName = new Animation(spriteSheet, new Animation.Frame(new Rectangle(98, 89, 27, 26), 300d)); Animation diveKickName = new Animation(spriteSheet, new Animation.Frame(new Rectangle(33, 89, 27, 30), 1000d)); AnimManager.AddAnimation(AnimationGlobals.WingedBattleAnimations.WingedIdleName, wingedIdle); AnimManager.AddAnimation(AnimationGlobals.WingedBattleAnimations.FlyingName, flyingName); AnimManager.AddAnimation(AnimationGlobals.HurtName, hurtName); AnimManager.AddAnimation(AnimationGlobals.DeathName, deathName); AnimManager.AddAnimation(AnimationGlobals.ParagoombaBattleAnimations.DiveKickName, diveKickName); //Wings are offset from the Paragoomba's body //Both Wings for each frame are in a single cropped texture //The wings are rendered underneath the Paragoomba's body wingedIdle.SetChildFrames( new Animation.Frame(new Rectangle(3, 166, 41, 18), 200d, new Vector2(0, -6), -.01f), new Animation.Frame(new Rectangle(50, 161, 41, 14), 200d, new Vector2(0, 6), -.01f)); flyingName.SetChildFrames( new Animation.Frame(new Rectangle(3, 166, 41, 18), 100d, new Vector2(0, -6), -.01f), new Animation.Frame(new Rectangle(50, 161, 41, 14), 100d, new Vector2(0, 6), -.01f)); hurtName.SetChildFrames( new Animation.Frame(new Rectangle(3, 166, 41, 18), 80d, new Vector2(3, -5), -.01f), new Animation.Frame(new Rectangle(3, 166, 41, 18), 80d, new Vector2(3, -5), -.01f)); deathName.SetChildFrames(new Animation.Frame(new Rectangle(3, 166, 41, 18), 100d, new Vector2(3, -5), -.01f)); diveKickName.SetChildFrames(new Animation.Frame(new Rectangle(120, 121, 31, 21), 1000d, new Vector2(1, -13), -.01f)); }
public override void LoadAnimations() { Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Neutral/ShellShieldShell.png"); AnimManager.SetSpriteSheet(spriteSheet); AnimManager.AddAnimation(AnimationGlobals.ShellBattleAnimations.FullHealthStateName, new Animation(spriteSheet, new Animation.Frame(new Rectangle(7, 3, 186, 130), 1000d))); Animation mildlyDamaged = new Animation(spriteSheet, new Animation.Frame(new Rectangle(7, 153, 186, 130), 1000d)); AnimManager.AddAnimation(AnimationGlobals.ShellBattleAnimations.MildlyDamagedStateName, mildlyDamaged); mildlyDamaged.SetChildFrames(new Animation.Frame(new Rectangle(217, 4, 13, 47), 1000d, new Vector2(0, -19))); Animation severelyDamaged = new Animation(spriteSheet, new Animation.Frame(new Rectangle(7, 153, 186, 130), 1000d)); AnimManager.AddAnimation(AnimationGlobals.ShellBattleAnimations.SeverelyDamagedStateName, severelyDamaged); severelyDamaged.SetChildFrames(new Animation.Frame(new Rectangle(242, 4, 42, 98), 1000d, new Vector2(0, -5))); }