A
Apples
Guest
Hello!
Player 1 and Player 2 are matching objects by placing them onto a field. Like a head-to-head puzzle game, I would like both players' objects to spawn in the same order.
What I have so far is a for loop that creates a list of randomized objects:
Create Event:
And as the objects are created, they scan the list until they find the next object on the list that hasn't been spawned and become it:
An object spawned for player 1:
While this works, and while I can create a thousand object-long table, it's probably not ideal. Any help would be appreciated.
Player 1 and Player 2 are matching objects by placing them onto a field. Like a head-to-head puzzle game, I would like both players' objects to spawn in the same order.
What I have so far is a for loop that creates a list of randomized objects:
Create Event:
Code:
for(var i=0; i<global.next_obj_table_len; i++;) {
global.next_obj[i,0] = irandom(global.total_objs);
global.next_obj[i,1] = 0; //if 1, this object has spawned for p1
global.next_obj[i,2] = 0; //if 1, this object has spawned for p2
}
An object spawned for player 1:
Code:
for(var i=0; i<global.next_elem_table_len; i++;) {
if global.next_obj[i,1] != 1 {
new_obj.o_type = global.next_obj[i,0];
global.next_obj[i,1]=1;
}
}