Haha I had a feeling it would be difficult because I have other features and games and stuff. Probably the most confusing are the arrays that I used which is because I had multiple lessons which load different sprites depending on what chapter you click.
I put all the images in a single sprite because its just much easier than creating a separate sprite for each image. I can store each chapter in 1 sprite and just load that single sprite. Much easier then creating 256 and counting sprites for each card I've made and finding out which sprites belong to which chapter.
The con_matching is a controller object that is placed in the matching room and is responsible for creating the cards and assigning each card its face value as well as handing the logic for the game. Here is what is happening in the create event. As I said you can remove half of this because you won't be having to match the image_indexes of two different card decks like I did since I had one for romanian and 1 for the english translated version.
// This code finds out which words from the word list were selected
// which ones weren't so it knows which cards shouldn't be included in the game
/*var type,xx,yy,i;
for (i=0;i<con_master.count;i+=1)
{
card_used[i] = con_list.active[con_list.lesson,i];
if card_used[i] = 1 card_used[i] = noone;
} */
// TO SIMPLIFY THIS FOR YOUR GAME
var type,xx,yy,i;
for (i=0;i<20;i+=1)
card_used[i] = 0; // ALL CARDS HAVEN'T BEEN USED
click = 2; // sets how many clicks until it checks for a match
check[0] = noone; // ro card log check // when the first card is clicked, its id will be stored here for comparision
check[1] = noone; // en card log check // same as above except for when the second card is clicked
//ro_number = con_master.left[con_list.lesson]; // number of avaliable cards // NUMBER FOUND BY HOW MANY SUBIMAGES THERE ARE.
// BECAUSE YOU ONLY HAVE 1 DECK I THINK YOU CAN REMOVE THIS
//if ro_number > 21 ro_number = 21; // limit number of displayed cards // LIMIT IT BECAUSE THE ROOM CAN ONLY DISPLAY SO MANY CARDS. YOU CAN REMOVE THIS
//en_number = ro_number; // MATCH THE ENGLISH SET WITH THE RO SET. YOU CAN REMOVE THIS
// THIS CODE CREATES THE CARDS ON THE TABLE.
xx = 16; // X AND Y OF THE FIRST CARD (TOP LEFT)
yy = 16; //
repeat(ro_number*2) // create up to 42 cards // BASED ON NUMBER OF SUBIMAGES BUT YOU CAN JUST PUT 20
/*{
// REMEMBER I HAVE TWO DECKS SO THIS LOGIC RANDOMLY CREATES A CARD FROM EACH DECK
if ro_number != 0 && en_number != 0 type = irandom(1);
if ro_number != 0 && en_number = 0 type = 0;
if ro_number = 0 && en_number != 0 type = 1;
if type = 0
{
instance_create(xx,yy,obj_romanian);
ro_number -= 1;
}
else
{
instance_create(xx,yy,obj_english);
en_number -= 1;
}*/
// YOU CAN SIMPLIFY THIS FOR YOUR GAME BY DOING THIS
instance_create(xx,yy,CARDS);
// THIS SECTION SETS THE NEW LOCATION FOR THE NEXT INSTANCE TO BE CREATED OTHERWISE YOU WILL HAVE
// 20 CARDS AT THE SAME LOCATION. YOU WILL NEED TO TWEAK THESE NUMBERS BASED ON YOUR SPRITE SIZE
xx += 144;
if xx > 740 // 740 IS THE LAST COLUMN LOCATION
{
xx = 16; // RESET X TO THE FIRST COLUMN
yy += 80; // SET Y TO THE NEXT ROW
}
}
// THIS FINDS WHICH CARDS ARE UNUSED AND SETS A VAR TO THE CARD OBJ
/*with (obj_romanian)
{
do
card = irandom(con_master.count - 1);
until other.card_used[card] = false; // find unused cards
other.card_used[card] = true; // identify used cards
}
with (obj_english)
{
do
card = irandom(con_master.count - 1);
until other.card_used[card] = true; // find used RO cards
other.card_used[card] = false;
}
// REPLACE THE ABOVE CODE WITH THIS
repeat (2)
{
with (CARDOBJ)
{
do
card = irandom(20);
until other.card_used[card] = false; // find unused cards
other.card_used[card] = true; // identify used cards
}
for (i=0;i<20;i+=1)
card_used[i] = 0; // RESET ALL CARDS BACK TO UNUSED SO YOU CAN REPEAT THIS
}
This is just the create event. I commented out all the code you didn't need. Once you understand this I can move onto the other stuff