/// <summary> /// Reconfigure the Animator. /// </summary> public void Reconfigure(AnimArgs args) { Reconfigure(args.StartFrame, args.CurrentFrame, args.FramesInLoop, args.FrameSpeed, args.AnimState); }
public Sprite(IMainGame mainGame, SpriteSheet spriteSheet, AnimArgs animArgs) : this(mainGame, spriteSheet, Vector2.Zero, Alignment.TopLeft, animArgs) { }
public Sprite(IMainGame mainGame, SpriteSheet spriteSheet, Vector2 position, Alignment alignment, AnimArgs animArgs) { MainGame = mainGame; // An animator is always required for the sprite to be drawn. The default constructor assumes the given spritesheet to be a single frame image. Animator = new Animator(this, spriteSheet); if (animArgs != null) { Animator.Reconfigure(animArgs); } if (GraphicsHelper.AntiShadowLibrary.ContainsKey(Animator.SpriteSheet.TexturePath)) { AntiShadow = GraphicsHelper.AntiShadowLibrary[Animator.SpriteSheet.TexturePath]; } else { AntiShadow = GraphicsHelper.GetAntiShadow(mainGame, Animator.SpriteSheet.Texture); GraphicsHelper.AntiShadowLibrary.Add(Animator.SpriteSheet.TexturePath, AntiShadow); } if (GraphicsHelper.SelfShadowLibrary.ContainsKey(Animator.SpriteSheet.TexturePath)) { SelfShadow = GraphicsHelper.SelfShadowLibrary[Animator.SpriteSheet.TexturePath]; } else { SelfShadow = GraphicsHelper.GetSelfShadow(mainGame, Animator.SpriteSheet.Texture); GraphicsHelper.SelfShadowLibrary.Add(Animator.SpriteSheet.TexturePath, SelfShadow); } if (alignment == Alignment.TopLeft) { Position = position; } else if (alignment == Alignment.TopRight) { Position = position + new Vector2(-spriteSheet.Texture.Width, 0); } else if (alignment == Alignment.Center) { Position = position + new Vector2(-spriteSheet.Texture.Width / 2, -spriteSheet.Texture.Height / 2); } else if (alignment == Alignment.BottomLeft) { Position = position + new Vector2(0, -spriteSheet.Texture.Height); } else if (alignment == Alignment.BottomRight) { Position = position + new Vector2(-spriteSheet.Texture.Width, -spriteSheet.Texture.Height); } }
public Player(IMainGame mainGame, SpriteSheet spriteSheet, AnimArgs switchAnimArgs) : base(mainGame, spriteSheet, switchAnimArgs) { PositionOffset = new Vector2(0, -54); }