A node that displays a 2D texture. The texture displayed can be a region from a larger atlas texture, or a frame from a sprite sheet animation.
Emitted when the frame changes.
Emitted when the texture changes.
If true
, texture is centered.
If true
, texture is flipped horizontally.
If true
, texture is flipped vertically.
Current frame to display from sprite sheet. hframes or vframes must be greater than 1. This property is automatically adjusted when hframes or vframes are changed to keep pointing to the same visual frame (same column and row). If that's impossible, this value is reset to 0
.
Coordinates of the frame to display from sprite sheet. This is as an alias for the frame property. hframes or vframes must be greater than 1.
The number of columns in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0
.
The texture's drawing offset.
If true
, texture is cut from a larger atlas texture. See region_rect.
If true
, the outermost pixels get blurred out. region_enabled must be true
.
The region of the atlas texture to display. region_enabled must be true
.
Texture2D object to draw.
The number of rows in the sprite sheet. When this property is changed, frame is adjusted so that the same visual frame is maintained (same row and column). If that's impossible, frame is reset to 0
.
Returns a Rect2 representing the Sprite2D's boundary in local coordinates. Can be used to detect if the Sprite2D was clicked.
Example:
Returns true
, if the pixel at the given position is opaque and false
in other case.
Note: It also returns false
, if the sprite's texture is null
or if the given position is invalid.