GML:
//Create Event
timer=room_speed*10
seat = 0;
//Step Event
if (timer <=1)
{
if(seat<=6)
{
show_debug_message(seat);
instance_create_layer(irandom(200),irandom(400),"Instances_1", oCustomer);
seat ++;
}
timer = irandom_range(room_speed*10, room_speed*20);
}
timer--;
I want to create instances of oCustomer based on a timer and variable. If (timer <=1) and (seats <= 6) it should stop making instances of oCustomer. It creates the instances one at a time but it doesn't stop making them at 6 and over time the instances are created quicker and quicker. What I noticed was from show_debug_message(seat) that the seat is trying to be reset back to zero constantly meaning seats is never = 6 which is why the instances don't stop creating themselves. The problem is I don't know where seats is being interfered with. I have no other objects where oCustomer is being interacted with and all the code for oCustomer is in Create and Step.