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
| Name | Type | Notes |
|---|---|---|
CanCollide | boolean | Whether it blocks other sprites moved with World2D:Move. |
CanQuery | boolean | Whether raycasts and overlap queries find it. |
Color | Color | Tints the image. |
FlipX | boolean | Mirrors the image left to right. |
FlipY | boolean | Mirrors the image top to bottom. |
HitboxOffset | Vector2 | Moves the hitbox from the sprite's centre. |
HitboxSize | Vector2 | The box collision and queries use. Zero means the sprite's own size. |
Image | string | The image file, relative to the project, or an http URL. A URL needs the Http permission. |
OnCeiling | boolean | Whether the last World2D:Move was stopped going up. Read-only. Not saved in places. |
OnFloor | boolean | Whether the last World2D:Move was stopped going down. Read-only. Not saved in places. |
OnWall | boolean | Whether the last World2D:Move was stopped going sideways. Read-only. Not saved in places. |
Pivot | Vector2 | The point of its box at Position, from 0, 0 at the top left to 1, 1 at the bottom right. |
Pixelated | boolean | Draws pixel art crisp when true, and smooths it when false. |
Position | Vector2 | Where the pivot is in the world, in world units, with y growing downwards. |
RegionOffset | Vector2 | The top left of the part of the image shown, in the image's pixels. |
RegionSize | Vector2 | The size of the part of the image shown. Zero shows the whole image. |
Rotation | number | Degrees clockwise about the pivot. Collision ignores it. |
Size | Vector2 | How big it is drawn in world units. Zero means the region's size, or the image's. |
Transparency | number | From 0, opaque, to 1, invisible. |
Visible | boolean | Whether it is drawn. A hidden sprite still collides. |
ZIndex | number | Higher 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.