let's say you got sprite spr_symbol with all 25 subimages as each symbol
- you can then make a ds_list
- use a loop to add the numbers 0-24 into it
- then do ds_list_shuffle
- you now read the first 4 of those into a separate list
- then do ds_list_shuffle again
- now .. the cards could be already laid out, then you could tell all of them:
Code:
with(obj_tile){
image_index = other.list[| 0]; // set my image_index as the symbol of the top of the list
ds_list_delete(other.list,0); // delete the symbol at the top of the list, so that the next tile gets the next
}
or create them as you read through em:
Code:
var i,a;
for(i=0;i<25;i++){
a=instance_create(obj_tile, (i div 5) * 32, (i mod 5) * 32); // div and mod is very handy to go through all the grid positions with a single variable
a.image_index = list[| i]; // then just pass over the symbol
}
- then delete the list
obj_tile would have image_speed set to 0 in the create event
Then you just have to check if the clicked image_index exists in the list of cards you should find..
Oh, you might need to do randomize() early in the game, or it will be using a default seed all the time and the shuffle results will be the same.
Hope that will help you get started