Swap cards with each other

The cards in my game get randomly placed at cardholders. Now I would like that when a card is dragged above another card and the click is finished that two cards get swapped. Would any one have an idea how to do that?

Store the initial position of the card when you grab it, and if you release click while it is in collision with another card, move the first to the position of the second and move the second to the stored position of the first.

1 Like

how do i store the initial position of the card?

1 Like

When click is pressed, write the X and the Y of the object in scene variables.

1 Like

Strugling with the same issue. Gruk may you please share a screen of how its done? THX

1 Like

Following!

Also following because the last game engine had a horrible forum with cocky people who wouldn’t help those of us who do not know. So I am very interested in knowing if this is the right game engine I should use based on the overall feedback.

Why scene variables rather than object variables within the cards themselves?

1 Like

@Psiweapon
It doesn’t really matter.
If you need to swap several cards, then using object variables makes sense. If you only need to swap two cards, using scene variables seems easier. :man_shrugging:

@Eny I don’t have any, but it’s quite straightforward. Read what I wrote above and convert everything to actions and conditions. :blush: Share a screenshot if you’re stuck :wink:

2 Likes