The Final Kithmaze help


I’ve been trying to figure out how to do this for like 10 minutes, and I can’t seem to figure out how. I’m using Javascript. Here’s my code:

var enemy = hero.findNearestEnemy();

while (true) {

I’ve tried sticking this part in all the different spots I can think of, but it always runs the code early, and it says that there isn’t an enemy in my line of sight.


Am I doing something wrong, or is the game bugging out?


Please format your code according to the FAQ. It makes it easier to understand your code.
your are missing I think if enemy in that.


Please tell us more about whats wrong. Also post this with your code. Remember to format your code according to the FAQ.


You are finding the nearestEnemy before even moving once.

When the function is called, that is when the nearestEnemy is assigned to the variable enemy.

So instead of hero.enemy you want to do var enemy = hero.findNearestEnemy();.


the enemy=self.findnearestenemy() dont
work at alllllllllllllllllll!!!:smiling_imp:


Are you using correct capitalization and spelling? Provide an instance in which enemy = hero.findNearestEnemy() does not work.


Please do not spam with exclamation marks. It does not help us as the consultant.

You need to capitalize every new word in self.findNearestEnemy

So its find Nearest Enemy() like what I wrote above. Also, if you are using java script, you must use this.findNearestEnemy instead of self


Please do not post the working code. Even though you completed it, somebody could get it. The point of this game is to help kids to learn to code through a game, but not to just give them the code. But good job with the level!


im using lua and ive been stuck for a month


@Peter_Fisher I would help but i have no idea how to use lua. it looks complicated. Sorry :confused:


Sorry about that!!!


while True:

enemy = hero.findNearestEnemy()
if len(hero,enemy)<60:


@wartxt Please could you say a bit more about what’s happening when you run the code.


Yes as @Deadpool198 mentioned, it is hard for us to help you if you have given us little information about what is wrong. Please give info about what is happening when you run your code, any errors when you run your code, and anything else that may be useful to help us help you!:smile: