SOLVED Image no longer interactive when image_index = 0

I have a game where i have food as objects that counts as 'bites' when you click them and they change into their bite sprites, and when you take a certain amount of bites and the food is all gone blood splatters animate into the screen (don't ask) in an animation that only plays once, and then once the blood is gone, the food all replenishes (image_index = 0) and their 'bite' count reverts to 0. however, the food items are no longer interactive after they're all replenished. can anyone pls help?

here's my code for the eating animation for food (left pressed)

image_index += 1;

bite += 1;


if (image_index = 0) {
bite = 0;
}


here's the code for the blood splatter (blood splatter is an object here)


if (food.bite == 76 && image_speed = 0) {
image_speed = 1;
} else if (floor(image_index) == last_frame) {
blood_splatter = true;
} else { image_speed = 0;
}


and here's the code for the food in step event

if (blood_splash.blood_splatter = true) {
bite = 0
image_index = 0;
}
 

Nidoking

Member
and here's the code for the food in step event

if (blood_splash.blood_splatter = true) {
bite = 0
image_index = 0;
}
What form does the interaction you're describing take? Might it be changing the bite and image_index variables? Because you're resetting those every step, so changing them will have no effect.
 
What form does the interaction you're describing take? Might it be changing the bite and image_index variables? Because you're resetting those every step, so changing them will have no effect.
the interaction there just makes the food go back to its first uneaten frame and the bite count revert back to 0. I tried to just put bite = 0 which makes the objects interactive again after the blood splatter animation, but it doesn't go back to its uneaten frame. likewise, I tried to only put image_index = 0 which makes the objects go back to its uneaten frame, but instead it's no longer interactive.
i don't understand why the image is no longer interactive after it goes back to image_index = 0.
 

Nidoking

Member
The image IS interactive. The interaction lasts for less than one frame, at which point, you are setting it back to zero. If you want the value to be anything that is not zero, you have to not set it to zero, explicitly, every step. Every time you set it to zero, it becomes zero. That's how variables work.
 
The above responses are right. You need to either restart the room for this to work, or reset all varaibles to false / 0 in the step events when the conditions you want are met. This includes making image_speed = 1 again.
I like the idea btw. At least what I imaged based on your summary :] .
 
Top