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
vdata
VariantData
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
time
GameTimegame time object from update
startFrame
intinitial frame
numberOfFrames
intlength of animation
interval
doublemiliseconds 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
drawPos
Vector2drawScale
Vector2shadowDrawPos
Vector2shadowScale
Vector2
Returns
- Rectangle
GetSourceRect(int)
Get source rect corresponding to a particular frame.
public Rectangle GetSourceRect(int frame)
Parameters
frame
intFrame, or sprite index
Returns
- Rectangle
SetAltVariant(string?)
public void SetAltVariant(string? altVariantKey)
Parameters
altVariantKey
string
SetFullVariant(VariantData, string?)
public void SetFullVariant(VariantData vdata, string? altVariantKey = null)
Parameters
vdata
VariantDataaltVariantKey
string