var obj; sound_play(sndClick); //click sound //Deselect all other objects sound_play(sndClick) selected = !selected; //toggle selected var count, obj, i; //temporary variables count = 0; //count starts at zero i = 0; //array index counter with (object_parent) //do the next code with all objects that have this as a parent { if (selected) //if I am selected { count += 1; //increase the count obj[i] = id; //store my ID in the array so we can access me later. i += 1; //increase this for the next array index (won't ever be more than 2 isntances, 0 and 1) } } if (count == 2) //when 2 objects are selected, let's find out if we matched them correctly { if (obj[0].object_index == obj[1].opposite) //if obj[0] is indeed obj[1]'s opposite { with (obj[0]) fade_out(); //fade out the first one! with (obj[1]) fade_out(); //fade out the second one! sound_play(sndTada); } else //otherwise... { room_restart(); //start over! } deselect_all(); //now let's deselect all objects, just to make sure none are selected }