chefdez
Member
Hello, everyone I have a simple cooking game here and I am using array_length_1d to cycle through my customers to see who entered the room first and has a particular food order.
I'm not sure how to get array_length_1d to cycle through the customers and see who is the first customer that walked in with a meat order. I've thought about using other but it won't specifically target the first customer to walk in and since array_length_1d moves backwards, I'm trying to figure out how to stop it at the earliest order. Am I overthinking this? Haha! Thanks
Code:
if cooked >= 100 && distance_to_object(o_chef) < 25 {
with(o_customer) {
for (var i = array_length_1d(myCount) - 1; i > -1; i--;) { // myCount is an array that stores which customer walked in the restaurant first
if custy[1] = foods.meat { // Here is where I am checking to see if my customer has a MEAT food order.
state = customer_state.EATING; // Changing that particular customers state to eating now that the food is cooked.
}
}
}
instance_destroy(); // Destroy object in our hand
}
Last edited: