+1 vote


I'm not sure my question is very clear so let me explain.

I got an open-source tileset (this one) where there's numbers in sprite form, for scoring and such I assume. But I wonder how you could turn a variable into those sprites?

So far I went for this structure:
Node structure

Give us that (I pre-allocated the "0" sprite on texture rect):

Should I make a folder with all the numbers sprites, parse them all, load them into an array and load the corresponding digits?
Or can you read it directly from the tileset on-the-go ?

Thanks in advance.

Godot version 3.5.1.stable
in Engine by (54 points)

1 Answer

+1 vote

Your solution should work and I think it's the easiest solution in case you want to continue using sprites.

But what if you decide to make a leaderboard or what if you need labels that have both letters and numbers? Using Sprites/TextureRects for numbers can quickly become overly complex. If you plan on using numbers of the same style elsewhere in your game, it might be a good idea to make a custom font using those sprites (I recommend this tutorial) or find another font that fits the style (or maybe you already have a font assuming your game has text). But if you want to use those sprites only for the score, maybe it's not worth the effort.

by (98 points)

Thought so as well, a font would be more efficient and less painful to deal with, definitely.
Thanks for the tutorial!

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.