Class TinkerAnimSprite
- Namespace
- TrinketTinker.Companions.Anim
- Assembly
- TrinketTinker.dll
Simplified animated sprite controller. Not a net object and must be built independently in each game instance.
public sealed class TinkerAnimSprite
- Inheritance
-
TinkerAnimSprite
- Inherited Members
Constructors
TinkerAnimSprite(VariantData)
public TinkerAnimSprite(VariantData vdata)
Parameters
vdataVariantData
Properties
Flip
public SpriteEffects Flip { get; }
Property Value
- SpriteEffects
Methods
AnimatePingPong(GameTime, int, int, double)
Reverse the animation from last frame, e.g. 1 2 3 4 3 2 1 2 3 4. Return true when animation return to first frame.
public TinkerAnimState AnimatePingPong(GameTime time, int startFrame, int numberOfFrames, double interval)
Parameters
timeGameTimegame time object from update
startFrameintinitial frame
numberOfFramesintlength of animation
intervaldoublemiliseconds between frames
Returns
- TinkerAnimState
True if animation reached last frame
GetBoundingBox(Vector2, Vector2, Vector2, Vector2)
Bounding box of the sprite, calculated at draw time because thats the most convienant way. Extends down to their shadow if they have one.
public Rectangle GetBoundingBox(Vector2 drawPos, Vector2 drawScale, Vector2 shadowDrawPos, Vector2 shadowScale)
Parameters
drawPosVector2drawScaleVector2shadowDrawPosVector2shadowScaleVector2
Returns
- Rectangle
GetSourceRect(int)
Get source rect corresponding to a particular frame.
public Rectangle GetSourceRect(int frame)
Parameters
frameintFrame, or sprite index
Returns
- Rectangle
SetAltVariant(string?)
public void SetAltVariant(string? altVariantKey)
Parameters
altVariantKeystring
SetFullVariant(VariantData, string?)
public void SetFullVariant(VariantData vdata, string? altVariantKey = null)
Parameters
vdataVariantDataaltVariantKeystring