Table of Contents

Method Play

Namespace
MonoGame.Aseprite
Assembly
MonoGame.Aseprite.dll

Play(int?, int?)

Starts the animation for this AnimatedSprite

public bool Play(int? loopCount = null, int? startingFrame = 0)

Parameters

loopCount int?

When a value is provided, specifies the total number of loop/cycles to perform before stopping the animation.

When null is provided, loop count will default to the value defined in the AnimationTag used to create this AnimatedSprite

0 = infinite looping

If IsPingPong is equal to true, each direction of the ping-pong will count as a loop.

startingFrame int?

When this value is provided, specifies the frame to start the animation at

When null is provided, play will start at frame 0 of the animation.

Returns

bool

true if animation play was successfully started for this AnimatedSprite; otherwise, false. This method returns false if the animation is already playing (when IsAnimating equals true).

Exceptions

ArgumentOutOfRangeException

Thrown if the startingFrame value provided is less than zero or is greater than or equal to the total number of frames in this AnimatedSprite.