Changing state based on value

Nov 03, 2016

This may be hard to explain in words. I'm trying to create a game, like that memory game where a series of pairs of cards must be matched. Since I am fairly a rookie I am trying to solve one small problem at a time. So far, I'm simply trying to change the state of the cards, so they reveal what is on the back side; but I want to prevent players from clicking on more than two cards. Once they click on two cards, if the pair is a match, a point is awarded; otherwise the cards go back to their initial state.

I'm using a variable, N, which starts in zero and increases by 1 after any card is clicked. Each card has a trigger to change the state when it is clicked and N is less than 2. I'm thinking maybe a reset button will set N back to zero for the next try. 

But it is not working; the cards continue changing the state, despite the value of N being 3, 4, etc. I am actually displaying the value of N and I see it.

Any suggestions what I may be doing wrong?

2 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.