Graphics displayed incorrectly (SOLVED)

I’m trying to make a card game and below is a section of my game screen, the card graphic displayed above is a reference to how the cards are roughly supposed to look like, but the lines below the card are the instances spawned by a card factory, they seem to be the middle section from my card graphics.

My Lua module containing the cards:

The section of my controller script that controls card creation:

The card script attached to prototype game object for the card factory:

The code had their debug codes removed but if I readd them and only run one instance of the draw_hand() code the log and game screen looks like this:


My cards atlas is this:

If it helps, I’m doing this on Mac, and as far as I can tell I don’t think there’s a problem with rotation.

It looks weird. One guess I would have made is that the cards are rotated, but you say they are not.

I see that you use msg.post("#sprite", “play_animation”, { id = self.card_graphic }). You could replace this with sprite.play_flipbook("#sprite", self.card_graphic) (I don’t think it matters though)…

Which version of Defold are you using? Can you reduce this down to a bare minimum project and share it here?

Is go with factory component have rotation?

It didn’t work no…

It could be a rotation problem, I’m quite new to Defold so I can’t be sure, the version I’m using is 1.5.0. I put my code in github

Your /controller game object has a rotation of (Y: 72), which causes the factory to rotate. If you set it to 0 you’ll be able to see the cards.

3 Likes

Thank you so much!!!

1 Like