Hello!
I am very new to GDevelop, so excuse me for my lack of knowledge.
I have a card game where the cards can be dragged around by the user and I need a method to save the position of every ‘card’ (or object) in the game so they can open the app again later and keep playing.
I saw a similar request about saving draggable objects, but I could not make sense of it.
First assign 2 variables to the card call this PosX, PosY so when you create the card in game set PosX = card.X(), PosY = card.Y() then check
if card isdragged (invert) (this means is not been dragged)
Condition → card.X() not equal to card.Variable(PosX)
Condition → card.Y() not equal to card.Variable(PosY)
Action —> Set card position.X to card.Variable(PosX)
Action —> Set card position.Y to card.Variable(PosY)
If I have some time I will prepare some example for you.
The same way you assign PosX or PosY you can add a counter and increment its value in the foreach at the begin of the scene
Logic is this
At the begin create a variable type number called CardsCounter = 0
In the events Foreach inside at the begin Assign Set Card.ID = CardsCounter and just below this set CardsCounter += 1