Search this manual

Sprite script interface

The ISpriteInstance interface derives from IWorldInstance to add APIs specific to the Sprite plugin.

Sprite APIs

getImagePointX(nameOrIndex)

getImagePointY(nameOrIndex)

Return the location of an image point on the current animation frame in layout co-ordinates. Image points are identified either by a case-insensitive string of their name, or their index. Note image point 0 is the origin, so index 1 is the first image point. If the image point is not found, this returns the origin instead.

setAnimation(name, from = "beginning")

Set the current animation by a string of its name (case-insensitive). from can be set to either "current-frame" to switch to the same frame index in the new animation, or "beginning" to rewind to the first frame.

animationName

A read-only string of the current animation name. Use the setAnimation() method to change the animation.

startAnimation(from = "current-frame")

Start playback of the current animation. from can be set to either "current-frame" to play from the existing frame, or "beginning" to play from the first frame.

stopAnimation()

Stop playback of the current animation.

animationFrame

The zero-based index of the current animation frame.

animationSpeed

The current animation playback speed, in animation frames per second.

animationRepeatToFrame

The zero-based index of the animation frame to rewind to when repeating an animation.

imageWidth

imageHeight

Read-only numbers indicating the size of the current animation frame's source image, in pixels.

Construct 3 Manual 2019-08-12

On this page