The Final Kithmaze help

This code looks ok but doesnt work, he walks to the wall and dies halfway. What is wrong with the code?

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

Welcome to the forum!! please format your code with the </> button but I see one error

this should be a uncappitalised w and a capitalised T

i believe that you also need a if enemy loop to find if there IS and enemy

@W_H in the future create a seperate post for this topic. This particular one has been dead for a while. I hope you enjoy your time here and if you have not already check out our FAQ. Thanks!

thanks (if this works)
ive been stuck at this for ages

it doesnt work you die in the spikes

thanks so much this helped alot

1 Like

None of these people are active anymore. They won’t be seeing your posts. But I am glad you have been helped.

1 Like

Oct. 2014 - Aug. 2021 -
The Final Kithmaze, through the ages…

4 Likes

I am so glad that this helped after 3 years, thanks! :blush:

boy were they wrong :smiling_imp:

All good things must come to an end…

Hehe, well, you haven’t posted for two years, so I wasn’t entirely wrong.

If you are using Python, try this
while True:
hero.moveRight()
hero.moveUp()
hero.moveRight()
enemy = hero.findNearestEnemy()
hero.attack(enemy)
hero.attack(enemy)
hero.attack(enemy)
hero.moveDown(2)
hero.moveUp()

Welcome to the forum! This is a family-friendly place where coders can share bugs, ask for help on any CodeCombat level (don’t forget to post your code correctly), or just hang out with other coders. But before you proceed, please check out our guidelines: this topic.
Have a great time! :partying_face:

I Dont Know If This Is Right Channel but in doing lua and this what i have

– Use a while-true loop to both move and attack.
local enemy = hero:findNearestEnemy()
while true do
self:moveRight()
self:moveUp()
self:attack(enemy)
self:attack(enemy)
self:moveRight()
self:findItems(gem)
end ‘’

Welcome to codecombat discourse! This is a cozy place where you can ask for help, get hints, and maybe just have fun! Before you proceed, we want you to review these three topics.

Welcome to CodeCombat Discourse Forums!

Welcome! New users, welcome to codecombat discourse! As you know, this place is where you can ask for help, get hints on levels, share experiences that you had while playing codecombat, reporting bugs, etc.! Feel free to enjoy your time here, but here’s a few things you should know before going ahead. Trust levels If you click on my profile picture, you should see a list of badges and in the first one, it should say, leader. That’s trust level 4. What exactly is a trust level? A trust level c…

[Essentials] How To Post/Format Your Code Correctly

Formatting your code before posting code is essential to our community, and if you don’t we might not be able to help frowning Everyone must know how to format ALL of your code properly. It’s really easy and only requires a very small amount of effort. [Screen Shot 2020-04-04 at 11.55.07] To post your code from the game , use the </> button or it won’t format properly. When you click the </> button, the following will appear: [Screen Shot 2020-04-04 at 11.55.36] Please paste ALL …

https://discourse.codecombat.com/faq 1

And if you need any help, feel free to ask the staff !

Enjoy your time in this forum!

Can you please format you code correctly, so we can see what is wrong and help you better,

Hello! Here’s my code

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

Hi @Lectorat instead of moving right after you attack the enemy, you might want to move down. Hope that hint helps!

2 Likes

Welcome to Codecombat discourse @Lectorat! This is a cozy place where you can ask for help, get hints, and just have fun! Before you proceed, we all want you to review these topics.

Welcome to CodeCombat Discourse Forums!

Welcome! New users, welcome to codecombat discourse! As you know, this place is where you can ask for help, get hints on levels, share experiences that you had while playing codecombat, reporting bugs, etc.! Feel free to enjoy your time here, but here’s a few things you should know before going ahead. Trust levels If you click on my profile picture, you should see a list of badges and in the first one, it should say, leader. That’s trust level 4. What exactly is a trust level? A trust level c…