Card Deck Builder help needed

Hey there.

I once made a simple multiplayer card game, it doesn’t contain all the features you’re looking for but may give you an idea for some parts a card game contains.

In addition, regarding card placing in player hands (the visual part) and drag-and-drop here are a few ideas which don’t require collision solids and also work with pretty much any number of cards.

For placeholders, you could just define a root point of your hand. Then from there on calculate the distance from the center depending on the amount of cards in the players hand. I’d start with a straight line and once that is good, you can add tilting and shifting cards to make it look round as if they are held by hands.
You can also add intervals to make them move smoothly to their places and also for highlighting or picking cards.

As for the picking itself without adding special collision solids, I’d recommend a very simple shader which you can find here:

With that, you just tag your cards and can pick them however they look and wherever they are. It’s also much faster than using the built in collision systems.
Once a card is picked, just mark it as dragged and move it with the mouse pointer. There should even be a sample in Panda3Ds manual describing picking and dragging objects.

Then, regarding the drop part, you could simply check the X-position of the card against the other cards in your hands for moving them within your hand and the Y or Z position depending on your orientation for activating that card or putting that card on the table or whatever else you’d like to with it. Afterwards just run a function to reposition the cards left in the players hand, which could be the same as for initial filling the players hand.

If you need more details on any of those parts or samples for things like intervals or drag and dropping 3D objects, just let me know.

1 Like