Hi everyone, I'm starting development of a card game, and I have used the following code in the command bar to fit 22 cards (ImageLabels, with offset sizes of 85 by 120) into the boundaries of a Frame, keeping a constant spacing between the cards:
for i,v in pairs(game.Selection:Get()) do v.Position = UDim2.new(v.Position.X.Scale,v.Position.X.Offset,(0+(0.0355*(i-1))),0) end
Here is an example of what Player 1's hand looks when using the following code, and here is an example of what I'm trying to achieve.
Now, I want to be able to keep fitting more cards into the Frame, as opposed to making a cap of 22 cards in a hand (so that the cards in the hand don't go outside the screen), but I have no idea how I would do this.
I am currently creating a card handling script to handle the loss/gain of cards of a player, and I am thinking of using the ChildAdded and ChildRemoved events to try and keep sorting the cards as new cards come in or as cards are played.
My question(s):
So I have multiple questions to ask, so I'll put them in a list:
Sorry if what I'm asking is too hard to understand, I'm just beginning to develop the game mechanics as I type up this question.