Playng around with Pairs

Hi.
I am experimenting a little wit the example game of pairs. It happens to me something strange. I only changed the pics ( same sizes, same form, just changed the images inside and the colour of card_back.) I also use the same name for the Sprite also if are different animals, but doing that, I do not know why, the selected card when opening, is moving of place and it covers some others cards. This gave me an idea for a workaround.

  1. Moving the 1st card on a specified position when uncovered and do the same with the second ( done).

  2. If cards are different, move back to their original position. (Probably must store the position of the chosen card in a global variable an then recover it if there is no pairs… ) but I can’t figure it out the right formula, can someone please help me?

Thanks

I don’t know the example. I think you should store the card’s position in object variables. for example each card should store its own position in “selfX” and “selfY”. and when it need to go back its own place, just set position to “selfX” and “selfY”.

Thanks! Your idea inspired me and now that part works. The only strange thing is that sometimes, the cards don’t open in the place i want.

Attached some examples with the part of code interested and the results. In the last pic, is how it

should look.


Thanks

1 Like

I agree, the idea is really great and you did such a great job

1 Like