I don’t have a custom label material. If you’re talking about the custom_font.material I tried to change it to the default builtins/fonts/font.material
but the problem remains.
Do you have a Z position set on the card sprite? You will also need to create each card at a different Z position for them to overlap properly.
Z position on the card sprite is 0 and 0.1 on the label. Each card is indeed created at a different Z position with a 0.001 increment.
I truly believe this is a rendering issue, but I can’t think of any way to solve it.
Well that’s the problem right there. You want the background of the top card to overlap the label of the bottom card, so the labels can’t be that far above of the sprites.
Let’s say you have two cards and you want the second to overlap the first.
- Card 1 - At Z=0
- Sprite Z = 0.0
- Label Z = 0.1
- Card 2 - At Z=0.001
- Sprite Z = 0.001
- Label Z = 0.1001
With those Z positions, your labels will always be drawn on top of the card backgrounds until you get more than 1000 cards.
That makes sense but even with a Z position of 0.000001 for the label, the problem remains…
No it won’t. You just need the increment between your cards to be greater than the increment between each card and its labels.
- Card 1 - At Z=0
- Sprite Z = 0.0
- Label Z = 0.0001
- Card 2 - At Z=0.001
- Sprite Z = 0.001
- Label Z = 0.0011
- Card 3 - At Z=0.002
- Sprite Z = 0.002
- Label Z = 0.0021
- …
- Card 1000 - At Z = 1
- Sprite Z = 1
- Label Z = 1.0001
Ok so, quick update: it works!
I’m not entirely sure as to why to be honest, but I tried to switch from a factory to a collection factory, in order to place the labels in a distinct GO inside a collection and it solved my issue. Thanks again for all your help!
Hi,
I am new to Defold and trying to create a card game, old style.
It would be great if you can share your template so we can learn quickly.
Thanks in advance.