I don't see my issue in this simple code (JavaScript)


#1

I don't see my issue in this simple code.

Could someone help me figure out what the issue is with this code? I've tried my best, but I can't seem to figure it out.

The level I'm currently on has the player on one side of the screen, and the other side of the screen is littered with poison and coins. I need to get the gems but avoid the poison. I avoid the peons because they're dying from the poison, but I'm attacking any ogres I see. Problem is, while the hero is attacking the ogres, he's not moving to get any coins. Where am I making my mistake?


#2

Ctrl-X Ctrl-V
one of "}"
from the line 12 to the line 17

Your while loop ends on line 12
Try to use the default style
closing } under keyword

while (true) {
}
if (true) {
}

#3

Thanks.


Thanks a ton! Moving the bracket from 12 to 17 fixed it. You rock!