• 2D
  • Should I use sprites or textures to represent cards in a card game?

Hey all, I've been testing my hand at Godot the past 2 weeks or so. I've been through 2 or 3 sets of intro tutorials and feel like I have a decent grasp of the basics. I've been trying to build a card game to test myself but I have an issue that's plaguing me. In terms of arranging the cards on the screen, are sprites better to use or texture rectangles?

Sprites don't play well with containers which is what I had used to build the structure of the game screen. But they can be animated which I was thinking might be useful (putting the card facedown, for example). Maybe I'm going about it the wrong way.

I already have much of the logic coded and working at the console, but I wanted to figure out the graphics stuff before investing more time in the logic lest it be for naught.

You could have the best of both worlds, in theory at least. If you parent a sprite to a control node, then in theory the control would play well with the containers, and then you can use the sprite for the graphics.

I’m not sure if will actually work though. I know you can mix and match Node2D drivied nodes and Control drivied nodes, so it might work.

If it doesn’t, then I’d suggest seeing what other nodes you’ll likely use the most. If you plan to use containers heavily and/or use lots of other control drivied nodes, then it may be worth it to use textured rectangles. If not, then maybe using sprites would be best. Seeing what other nodes you plan on using may help you decide.

That’s my two cents on the matter. I probably should mention that I mainly specialize in the 3D side of Godot, so my 2D/GUI side isn’t quite as polished. There may be a better ways to go about it :smile:

I had no idea that was an option to make the sprite a child of a Control node! I tried it quickly and it works, next is to see if it makes things easier or harder. After I made the post yesterday, I tried both and I think I might stick with sprites and position it through scripting (calculating the centre of the container) as opposed to using the container itself.

I think most people don’t know you can mix and match Node2D/Control nodes. I only found it by accident :grin:

Good luck with your game!