This site requires JavaScript, please enable it in your browser!
Greenfoot back
Starlord
Starlord wrote ...

2017/6/8

How to flip a card using stride on greenfoot

Starlord Starlord

2017/6/8

#
The point of the game is to flip the card and find its pair, if they match the cards stay up if not they flip back over. Having trouble on how to flip the card and having them stay if they're a match and flipping them back if they are not.Using stride.
Super_Hippo Super_Hippo

2017/6/9

#
I've never used stride, but in "normal code" I would say you have to do the following things: a card class - a variable in the class which will be the same for a pair and different to the others - a getter method for this variable - a method to flip the card (change image) a world class - check if a click is made on a card (in the act method). flip the card (call the flipping method on the card) and save a reference to the flipped card. When a second one is clicked, compare the variable in the saved (first clicked) card to the variable in the just (second) clicked card. If they do not match, flip them back. If the match, don't. In both cases, remove the reference to the card
You need to login to post a reply.