I'm trying to create a Flip & Match memory game here. Right now, what I achieve is when 2 cards is flip over and if both doesn't match. It will flip back to the cover.
I was thinking of only flipping back the 2 cards when the 3rd card is clicked.
ActionScript Code:
private function checkCards(event:MouseEvent):void {
//event.currentTarget.removeEventListener(MouseEvent.CLICK, checkCards);
if (_firstCard == undefined) {
_firstCard = event.currentTarget;
} else if (prevCards == "opened") {
trace("third");
_firstCard.gotoAndPlay("flipBack");
_2ndCard.gotoAndPlay("flipBack");
} else if (String(_firstCard._type) == String(event.currentTarget._type)) {
trace("match");
_firstCard = undefined;
} else {
trace("wrong");
_2ndcard = event.currentTarget;
prevCards = "opened";
}
Right now I don't know how I can change the 2 cards to a "ready to close cards" rather than sharing the same _firstCard with the 3rd car.
Any idea how I could over come this problem?