Tiling/repeating a Sprite2D that's animated using the "frame" property

Godot Version

4.2.0.stable.mono

Question

I have a Sprite2D that has a sprite sheet for a texture, it is animated by setting up the h_frames, and w_frames properties and then changing the frame property using an AnimationPlayer.

The problem I’m having is I want to tile/repeat this sprite. One common way of doing this is to edit the region properties to make the texture repeat over the size you need. Though this doesn’t seem to work when you have set up an animation in the fashion described above. The region settings seem to mess up the frame coords.

So the question I have is there a way to do this, something I’m missing?

Thanks

1 Like

I’m not sure if it would work for your specific circumstances, but you could always use a Tilemap instead of a simple sprite 2d.

1 Like

Depending on what exactly you’re trying to achieve;

Like Yeah suggested, A Tilemap can do animations and obviously tile. Mostly for environment though.

If you’re just wanting to change the size of the sprite you could use scale (you’d need the texture to be scalable too).

Alternatively you could use an AnimatedSprite2D, it’s sprite frames allow for sprite sheet separation.

I have the same issue. My use case is a laser beam with variable width that I also want to animate when it gets activated.

I was able to use the region properties to continuously extend the texture. With an AnimationPlayer I was then able to change the texture property. This is a bit cumbersome to set up, though, so I thought I could use the animation properties of Sprite2D. As OP mentioned, this does not seem to work. In the region, one still has to specify the width and height of the entire spritesheet. When using a larger width/height the next sprite in the sheet gets shown instead of repeating the currently selected frame.