Best way to repeat a symbol for health/ammo/etc "pips"?

Godot Version

4.4 dev 2+ (built from master source)

Question

Like the Zelda hearts:
Zelda Hearts

I’m trying to make a generic scene/script for showing “pips” for stats like lives, health, ammo, limited-use abilities like bombs etc.

Basically: Repeat a symbol for the remaining units, then, optionally, repeat a different symbol for the units that have been used/consumed.

So, 3 out of 5 lives remaining = :heart::heart::heart::black_heart::black_heart:

Obviously creating multiple nodes, one for each “pip” will work but it won’t be efficient and it may harm FPS. I’d rather have 1 texture and Node and just specify a region to repeat/tile that texture/image in. I have tried the following Nodes and settings:

Using a file with a SINGLE image/texture works fine, by setting “Repeat” = Enabled, and the “Region” to the area taken up by the Sprite2D on screen.

But when using a texture atlas or sprite sheet like 1-Bit Pack · Kenney it doesn’t work, as you can see in the last 2 nodes on the bottom right in the screenshot above.

Is there any way to achieve texture repeating/tiling with an AtlasTexture? Do I have to use shaders?

1 Like

I think tiling an atlas texture was never supported for some reason. The oldest report I found about it was from godot 2 and the newest is this (I know it’s godot 3 but I think nothing changed regarding that issue):
https://github.com/godotengine/godot/issues/38021

2 Likes