+3 votes

Not sure if what Im trying is legal. I have a long collisionshape2D that is a platform, and I'd like for it to look like a brick wall (think like mario bros platforms). I DL a brick texture (jpg) and assigned it to a sprite that is the same size as the collisionshape2D. I assumed that Godot would tile the texture repeatedly and I could size it until it spanned the sprite length, but it won't and Im not even sure what Im trying is legal. My fix is several smaller square sprites (and appropriately scaled texture) that span the long collisionshape2D. To me this seems inefficient - or maybe it's not? Thanks for help in Advance. below is my texture import log:

"vram_texture": false


files=[ "res://.import/stone2.jpg-648ba8c1b0479e62cefbf8c964439136.stex" ]



in Engine by (29 points)

1 Answer

+4 votes

It's probably easier to use a TextureRect for this:

Using A TextureRect

  1. Create a TextureRect-node
  2. Assign your image as its texture
  3. Set expand to true
  4. Set strech_mode to STRETCH_TILE / 2
  5. Set rect_size to the dimensions you wish for

That said, if it has to be a Sprite, here you go:

Using A Sprite

  1. Select your image in the "FileSystem"-Tab
  2. Switch over to the "Import"-Tab (next to the "Scene"-Tab)
  3. Set "Repeat" to "Enabled" and click "Reimport" (at the bottom)
  4. Create a Sprite-node
  5. Assign your image as its texture
  6. Set region_enabled to true
  7. Set region_rect to the dimensions you wish for
by (10,584 points)

Thanks so much for the help. I am using 3.2 so I didn't have the property selections that you indicated.

I did find a solution, however. My platform is 64pix deep x whatever length, Im going in even grid increments (64 pix reticules), so I resized my main texture to 64x64, created a TextureRect that was 64 pix thick and 64 x N blocks long and set the stretch mode to tile. That repeated the pattern. It works, and Ive learned several things just with struggling with this.

I used to make maps for Counter Strike years ago and I was used to being able to apply a texture to a polygon and size it in the editor, so I thought that would apply here. I'm sure it does and I am having success but maybe what I remember with mapping tools is not the same implementation here. Just gotta learn!

I'm using 3.2 as well. I don't know, what exactly you're referring to by "property selections" here, but you're probably just looking for it in the wrong place:

  • The "FileSystem"-Tab is by default in the lower-left of the window
  • The "Import"-Tab is by default in the upper-left of the window
  • Everything else is done in the "Inspector", which is by default on the right side

Your solution equals the one I proposed under "Using A TextureRect". What you describe from your Counter Strike days is possible by following the steps 1-3 from my second solution (titled "Using A Sprite"), then creating a Polygon2D-node and setting it's texture-property to that image. It will fill out the Polygon completely (by repeating itself) and adapt accordingly, when you resize the Polygon later on.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.