private void LoadContent() { Texture = Game.Content.Load<Texture2D>("apple"); block = Game.Content.Load<Texture2D>("black"); appleDie = new Animation(Game.Content.Load<Texture2D>("appledice"), 0.02f, false, "die"); animator = new Animator(appleDie); }
/// <summary> /// Plays a certain animation /// </summary> /// <param name="anim">The animation to play</param> /// <param name="effects">The sprite effect to use</param> public void Play(Animation anim,SpriteEffects effects) { if (Animation.Name == anim.Name) { //Don't do anything return; } //Reset the current animation mEffects = effects; Animation = anim; mFrameRect.X = 0; mElaspedTime = 0; mCurrentFrame = 0; }
/// <summary> /// Main constructor /// </summary> /// <remarks>Using this should be the norm for an animator</remarks> /// <param name="anim">The animation to play</param> public Animator(Animation anim) { //Set up the rectangle mFrameRect = new Rectangle(0, 0, anim.FrameWidth, anim.FrameHeight); Animation = anim; }