Skip to content

Sprite ​

An image in a World2D, or one part of a sprite sheet, placed by its pivot in world units.

Inherits Instance.

Made with Instance.new("Sprite").

Classes that inherit it: AnimatedSprite.

Properties ​

NameTypeNotes
CanCollidebooleanWhether it blocks other sprites moved with World2D:Move.
CanQuerybooleanWhether raycasts and overlap queries find it.
ColorColorTints the image.
FlipXbooleanMirrors the image left to right.
FlipYbooleanMirrors the image top to bottom.
HitboxOffsetVector2Moves the hitbox from the sprite's centre.
HitboxSizeVector2The box collision and queries use. Zero means the sprite's own size.
ImagestringThe image file, relative to the project, or an http URL. A URL needs the Http permission.
OnCeilingbooleanWhether the last World2D:Move was stopped going up. Read-only. Not saved in places.
OnFloorbooleanWhether the last World2D:Move was stopped going down. Read-only. Not saved in places.
OnWallbooleanWhether the last World2D:Move was stopped going sideways. Read-only. Not saved in places.
PivotVector2The point of its box at Position, from 0, 0 at the top left to 1, 1 at the bottom right.
PixelatedbooleanDraws pixel art crisp when true, and smooths it when false.
PositionVector2Where the pivot is in the world, in world units, with y growing downwards.
RegionOffsetVector2The top left of the part of the image shown, in the image's pixels.
RegionSizeVector2The size of the part of the image shown. Zero shows the whole image.
RotationnumberDegrees clockwise about the pivot. Collision ignores it.
SizeVector2How big it is drawn in world units. Zero means the region's size, or the image's.
TransparencynumberFrom 0, opaque, to 1, invisible.
VisiblebooleanWhether it is drawn. A hidden sprite still collides.
ZIndexnumberHigher draws on top. Equal ones draw in tree order.

Inherited ​

From Instance: AddTag, AncestryChanged, Archivable, AttributeChanged, Changed, ChildAdded, ChildRemoved, ClassName, ClearAllChildren, Clone, DescendantAdded, DescendantRemoving, Destroy, Destroying, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, GetDescendants, GetFullName, GetPropertyChangedSignal, GetTags, HasTag, IsA, IsAncestorOf, IsDescendantOf, IsPropertyModified, Name, Parent, QueryDescendants, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild.

Apache License 2.0