Skip to main content

AnimatedSprite

Namespace: MonineEngine.Graphics.Animations

public class AnimatedSprite : MonineEngine.Graphics.Sprite

Inheritance ObjectSpriteAnimatedSprite
Attributes NullableContextAttribute, NullableAttribute

Properties

Finished

Gets whether the currently playing animation has finished, and is currently awaiting animation changes.

public bool Finished { get; private set; }

Property Value

Boolean

Animation

The animation for the animated sprite. If this is altered, the animation process will restart at the first frame of the new animation.

public Animation Animation { get; set; }

Property Value

Animation

Region

Gets or sets the source texture region represented by this sprite.

public TextureRegion Region { get; set; }

Property Value

TextureRegion

Texture

The texture of the sprite, defined by the Region of the sprite.

public Texture2D Texture { get; set; }

Property Value

Texture2D

Color

The color mask to apply when rendering this sprite. Acts as a tint.

public Color Color { get; set; }

Property Value

Color

Remarks:

Default value is Colour.White

Rotation

The rotation, in radians, to apply when rendering this sprite.

public float Rotation { get; set; }

Property Value

Single

Remarks:

Default value is 0.0f

Scale

The scale factor to apply to the texture when rendering the sprite.

public Vector2 Scale { get; set; }

Property Value

Vector2

Remarks:

Default value is Vector2.One

Origin

The origin point of the texture, relative to the top-left corner, of this sprite.

public Vector2 Origin { get; set; }

Property Value

Vector2

Remarks:

Default value is Vector2.Zero.

Effects

Gets or Sets the sprite effects to apply when rendering this sprite.

public SpriteEffects Effects { get; set; }

Property Value

SpriteEffects

Remarks:

Default value is SpriteEffects.None

LayerDepth

Gets or Sets the layer depth to apply when rendering this sprite.

public float LayerDepth { get; set; }

Property Value

Single

Remarks:

Default value is 0.0f

Width

Gets the width, in pixels, of this sprite.

public float Width { get; }

Property Value

Single

Remarks:

Width is calculated by multiplying the width of the source texture region by the x-axis scale factor.

Height

Gets the height, in pixels, of this sprite.

public float Height { get; }

Property Value

Single

Remarks:

Height is calculated by multiplying the height of the source texture region by the y-axis scale factor.

Constructors

AnimatedSprite()

Constructs a new animation sprite.

public AnimatedSprite()

Remarks:

Using this constructor will result in AnimatedSprite.Animation being null upon creation. As such, it must be defined later.

AnimatedSprite(Animation)

Constructs a new animated sprite with the specified frames and delay.

public AnimatedSprite(Animation animation)

Parameters

animation Animation
The Animation for this animated sprite.

Methods

Update(GameTime)

Updates the animated sprite.

public void Update(GameTime gameTime)

Parameters

gameTime GameTime
The of the engine instance.

Events

ReachedAnimationEnd

Called when the animation reaches the final frame. If looping is disabled, this will call endlessly until

public event EventHandler<AnimationEndEventArgs> ReachedAnimationEnd;