class-description NEWS COMMUNITY STORE LABS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE LABS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNodeCanvasItemNode2D Sprite2D
General-purpose sprite node.

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.

frame_changed frame_changed<>():frame_changed

Emitted when the frame changes.

texture_changed texture_changed<>():texture_changed

Emitted when the texture changes.

bool centered<>():bool

If true, texture is centered.

bool flip_h<>():bool

If true, texture is flipped horizontally.

bool flip_v<>():bool

If true, texture is flipped vertically.

int frame<>():int

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.

Vector2i frame_coords<>():Vector2i

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.

int hframes<>():int

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.

Vector2 offset<>():Vector2

The texture's drawing offset.

bool region_enabled<>():bool

If true, texture is cut from a larger atlas texture. See region_rect.

bool region_filter_clip_enabled<>():bool

If true, the outermost pixels get blurred out. region_enabled must be true.

Rect2 region_rect<>():Rect2

The region of the atlas texture to display. region_enabled must be true.

Texture2D texture<>():Texture2D

Texture2D object to draw.

int vframes<>():int

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.

Rect2 get_rect<>():Rect2

Returns a Rect2 representing the Sprite2D's boundary in local coordinates. Can be used to detect if the Sprite2D was clicked.

Example:

func _input(event): if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: if get_rect().has_point(to_local(event.position)): print("A click!")
bool is_pixel_opaque<>( Vector2 pos=, pos:Vector2=, ):bool

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.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...