how to make texture repeat on scale (2d)

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

basically, how do i make texture (sprite2d or other stuff) repeat the texture after scaling?
like, on scale(1,1) there will be 1 brick and on scale(2,1) there will be 2 bricks and so on.

:bust_in_silhouette: Reply From: Tom Mertz

Is there a reason you need to do it with scale? I think this is pretty easy to achieve if you set the image to import as repeating and then add enable the region. Then you can “scale” it by increasing the region_rect’s w and h properties. See image below for a quick example, notice scale stays 1.

enter image description here

Godot 4

I just noticed you are using Godot 4. With Godot 4 you do not need to change the import settings for your image. Instead, on your sprite, you expand the CanvasItem’s Texture property and set Repeat to “Enabled” Everything with the region is still the same:

enter image description here

1 Like