Closed shuzel99 closed 3 years ago
Yes, you're on the right track there! Setting the conditional to a boolean will continue to call it over and over again while this.alive
remains true. Maybe refactor using the opposite logic, so that instead something happens when this.alive
becomes false
What's the problem you're trying to solve?
While the game is running it's constantly checking if a certain class has gotten into a collision and I think it's causing my computer to crash.
Post any code you think might be relevant (one fenced block per file)
If you see an error message, post it here. If you don't, what unexpected behavior are you seeing?
"Are u ok?" will log in the console several times per second until eventually my computer shuts down.
What is your best guess as to the source of the problem?
I think I need to limit the number of times the function checks if the items in the Shopping class are alive but I'm not sure how.
What things have you already tried to solve the problem?
Tried integrating setInterval but I might be doing it wrong.