public override void LoadContent() { Texture = ContentManager.GetTexture("ForestBossIdle"); Animation ani = new Animation(ContentManager.GetTexture("ForestBossAttack"), 2, 24, 0, true, SpriteEffects.None); mAnimator.Animations.Add("ForestBossAttack", ani); ani = new Animation(ContentManager.GetTexture("ForestBossIdle"), 1, 24, 0, true, SpriteEffects.None); mAnimator.Animations.Add("ForestBossIdle", ani); mAnimator.PlayAnimation("ForestBossIdle", false); base.LoadContent(); }
/* * bRestart : if true and animation is already playing, restart animation */ public void PlayAnimation(String animation, bool bRestart) { if (!Animations.ContainsKey(animation) || (!bRestart && animation.Equals(CurrentAnimation))) { return; } mAni = Animations[animation]; if (mCurrAnimation == null || mAni.Priority > mCurrAnimation.Priority || (mCurrAnimation.Priority % 10 == 0 && mCurrAnimation.Priority == mAni.Priority)) { mCurrAnimation = mAni; CurrentAnimation = animation; } }
public override void LoadContent() { //Texture = ContentManager.GetTexture("IceWalkingRight"); Animation ani = new Animation(ContentManager.GetTexture("UrsoWalkingRight"), 2, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("NormalWalkRight", ani); ani = new Animation(ContentManager.GetTexture("UrsoWalkingRight"), 2, 8, 0, true, SpriteEffects.FlipHorizontally); mAnimator.Animations.Add("NormalWalkLeft", ani); ani = new Animation(ContentManager.GetTexture("UrsoWalkingFront"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("NormalWalkFront", ani); ani = new Animation(ContentManager.GetTexture("UrsoWalkingBack"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("NormalWalkBack", ani); ani = new Animation(ContentManager.GetTexture("IceWalkingRight"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("IceWalkRight", ani); ani = new Animation(ContentManager.GetTexture("IceWalkingRight"), 5, 8, 0, true, SpriteEffects.FlipHorizontally); mAnimator.Animations.Add("IceWalkLeft", ani); ani = new Animation(ContentManager.GetTexture("IceWalkingFront"), 4, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("IceWalkFront", ani); ani = new Animation(ContentManager.GetTexture("IceWalkingBack"), 4, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("IceWalkBack", ani); ani = new Animation(ContentManager.GetTexture("FireWalkingRight"), 4, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("FireWalkRight", ani); ani = new Animation(ContentManager.GetTexture("FireWalkingRight"), 4, 8, 0, true, SpriteEffects.FlipHorizontally); mAnimator.Animations.Add("FireWalkLeft", ani); ani = new Animation(ContentManager.GetTexture("FireWalkingFront"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("FireWalkFront", ani); ani = new Animation(ContentManager.GetTexture("FireWalkingBack"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("FireWalkBack", ani); bMoving = false; mAnimator.PlayAnimation("NormalWalkRight", false); base.LoadContent(); CollisionBox = new Rectangle(CollisionBox.X, CollisionBox.Y, 25, 25); }
public override void LoadContent() { // good bears Animation ani = new Animation(ContentManager.GetTexture("BrownBearWalkRight"), 4, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("walkRight", ani); ani = new Animation(ContentManager.GetTexture("BrownBearWalkRight"), 4, 8, 0, true, SpriteEffects.FlipHorizontally); mAnimator.Animations.Add("walkLeft", ani); ani = new Animation(ContentManager.GetTexture("BrownBearWalkFront"), 4, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("walkFront", ani); ani = new Animation(ContentManager.GetTexture("BrownBearWalkBack"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("walkBack", ani); // evil bears ani = new Animation(ContentManager.GetTexture("WoodBearWalkRight"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("evilwalkRight", ani); ani = new Animation(ContentManager.GetTexture("WoodBearWalkRight"), 5, 8, 0, true, SpriteEffects.FlipHorizontally); mAnimator.Animations.Add("evilwalkLeft", ani); ani = new Animation(ContentManager.GetTexture("WoodBearWalkFront"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("evilwalkFront", ani); ani = new Animation(ContentManager.GetTexture("WoodBearWalkBack"), 5, 8, 0, true, SpriteEffects.None); mAnimator.Animations.Add("evilwalkBack", ani); base.LoadContent(); if (CollisionBox.Width == 0 || CollisionBox.Height == 0) { CollisionBox = new Rectangle(CollisionBox.X, CollisionBox.Y, 40, 40); } }
public Animator() { Animations = new Dictionary<string, Animation>(); CurrentAnimation = null; mCurrAnimation = null; }