The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

I want to make this texture repeat itself until a certain coordinate how would I do that

Godot version 3.5.1
in Engine by (17 points)

1 Answer

+1 vote
Best answer

Not sure if this is 2D or 3D but perhaps try looking into tilemaps or using an area node. Otherwise you could do this in one script:

1.) Instance one of the textures at a starting point.
2.) Create a 'maximum distance' for each axis. This will be the X, Y, Z coords that the texture stops at.
3.) Create a 'snapping distance' for the nodes. This will be the amount that the textures are translated each time they are instanced.
4.) Keep instancing the textures with the Vector2/Vector3 translations of the last added node added by the snapping distance. This will place them evenly.
5.) Add an 'If' statement that checks if the instanced node is greater than the maximum distance for each axis.
6.) When the node is past the maximum distance, call queue_free() on the node.

This can all be done cleanly in a for loop but it's not necessary. Areas would be an easy way to do this if you have trouble with the maximum distance.

by (137 points)
selected by

I used tile maps as you suggested at the start of your answer and it worked. thanks

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.