Hey there! TL;DR in bold below!
I've seen this question pop up quite a few times on the Reddit, but from what I found, only a handful were recent enough for Godot 4, and all of them refer to an isolated Sprite2D
/TextureRect
Node.
Basically, I have a texture.png
that I'd like to use for solid walls in my top-down shooter - plop one down somewhere, resize to your liking, bam; new wall, with collision and everything.
Understandably, saving this Solid.tscn
scene, adding one to the level, and scaling it (to keep the collider etc. proportional) does not result in the sprite tiling itself to fill the new space, but instead it stretches it.
Image & explanation below:
Background
(box on the left) is a regular Sprite2D I've put in the root scene.- -
Region = Enabled
(and set to the size I wanted) - -
CanvasItem > Texture > Repeat = Enabled
Solid
is an instance ofSolid.tscn
as described above (StaticBody2D > Sprite2D, CollisionShape2D
)- -
Node2D > Transform > Scale.Y = 1.5
to show that the text gets stretched, i.e. it does not tile itself like Background does.
Basically, my question is: Is it possible to have a Packed Scene that will tile itself once scaled inside of another scene?
Note: the actual texture I have is like 2000x2000px -- I'll gladly trim it "down" instead of tiling it "up", if need be; I just don't want the hassle of manually setting the collision box to match the tiled sprite each time I edit it...
Thanks in advance!