Right, so I'm working on some code for a tiny little game, and I was wondering if it's possible to stop a loop which generates elements. When they the meteors collide with "felix" (I have function for that), a game over overlay is shown, but I need to stop that loop from running forever.
Hello beautiful people!
Right, so I'm working on some code for a tiny little game, and I was wondering if it's possible to stop a loop which generates elements. When they the meteors collide with "felix" (I have function for that), a game over overlay is shown, but I need to stop that loop from running forever.
Is it possible to stop this function createMeteor or the loop inside it?
Thanks in advance!
http://www.ryerson.ca/JavaScript/lectures/flowControl/transfer/breakContinue.html
I feel like I'm missing something here. What is the point of having a for loop when you only have one element?
Maybe because it's a game he only wants it to run once in this particular case but may need it to run more than once somewhere else. I have no idea.
Use a 'while' loop, not a for loop