Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

The Final Kithmaze help


#42

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.
https://discourse.codecombat.com/faq


#43

Please tell us more about whats wrong. Also post this with your code. Remember to format your code according to the FAQ.
https://discourse.codecombat.com/faq


#44

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();.


#45

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


#46

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


#47

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


#49

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!


#50

im using lua and ive been stuck for a month


#51

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


#52

Sorry about that!!!


#53

while True:

hero.moveRight()
hero.moveUp()
hero.moveRight()
hero.moveDown(2)
hero.moveUp()
enemy = hero.findNearestEnemy()
if len(hero,enemy)<60:
    hero.attack(enemy)

#54

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


#55

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:

-@Luke10


#57

I have a question. The only error I run into with my code it the whiletrue function. It works, but I cannot figure out how to run it to where the program runs correctly. I use Python. I read the hints to try to make an understanding, but I don’t get it. It’s very infuriating, considering I went through all of the other levels leading up to this one without any trouble.


#58

Post your code and use the </> button so I can see the error.


#59
while True:
    hero.moveRight()
    hero.moveUp()
    hero.moveRight()
    enemy = hero.findNearestEnemy()
    hero.attack(enemy)
    
    


#60

After this, my hero continues to run into the wall. Do you have any advice on how to stop him from doing this?


#61

Well, you didn’t write any hero.moveDown(), so you will never go down.


#62

I did the down before, and I ran into the wall also.


#63

When I write

while True:
    hero.moveRight()
    hero.moveUp()
    enemy = hero.findNearestEnemy()
    hero.attack(enemy)
    hero.moveDown()
    
    

It walks backwards to the last point.