How can I make states change when two variables are equal?
Dec 20, 2012
I may be approaching this the wrong way but here goes.
I have created a grid of rectangles. Each rectangle contains a word or phrase or picture. Each rectangle is paired with another rectangle so one rectangle may have a picture of a dog and another would have the word "dog" written on it. My desired result is that when the user clicks the picture of the dog and the word dog both rectangles would disappear.
I'm approaching this by changing the state of the rectangle to hidden but I'm having trouble with the logic. So far I've created a variable with different assigned values for each rectangle and when the user clicks the rectangle the value of the variable changes. Initially none of the variables has the same value as another variable. Clicking rectangle1 changes the value of variable1.
Let's say the picture of the dog is on rectangle1 and the word "dog" is on rectangle8. When the user clicks on rectangle1 the value "dog" is assigned to variable1. When the user clicks on rectangle8 the value "dog" is assigned to variable8. When two variables match I want the rectangles associated with those variables to disappear (state changes to hidden).
I haven't been able to figure out how to make this happen although I'm sure it can be done. Any help would be appreciated!
This discussion is closed. You can start a new discussion or contact Articulate Support.