how to set region_rect?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By potatobanana

i have two sprite male and female, with different region set, but i dont know how to set_region_rect ,
i do like this but wont work

$playerBase/skin.set_region_rect(32, 800, 32 , 64)

sorry for my broken english

:bust_in_silhouette: Reply From: kidscancode

region_rect takes a Rect2 object, not a list of four integers.

$playerBase/skin.region_rect = Rect2(32, 800, 32, 64)

https://docs.godotengine.org/en/latest/classes/class_sprite.html#class-sprite-property-region-rect

thank you very much, you help me allot more than all doc, i did read doc but cant understand it. thank you.

potatobanana | 2019-02-19 13:09