Yes, whenever the condition for the while loop (in your case "while(key_w)") is false, the loop stops, and the next code in your function is being executed.
To see how it works, you could try this instead:
function spam_objects()
{
// Wait till key_w is pressed
while(key_w == 0) {wait(1);}
// Spawn the object
spawn_object();
// Wait till key_w is not pressed anymore
while(key_w) {wait(1);}
// Wait till key_w is pressed the second time
while(key_w == 0) {wait(1);}
// Spawn the object again
spawn_object();
// And then nothing more happens
}
Also replacing "while (key_w)" with "while (key_w == 1)" doesn't do anything.
The condition (key_w) is the same as (key_w != 0)
