Hi i,am Bejamin my age is 8 years old
and i,am stuck here
i,am stuck at the last kithhof i,am using this code…
( while true do
hero:moveRight()
hero:moveUp()
hero:moveDown()
enemy = hero:findNearestEnemy()
end)
and it does not work i tried every thing and i just get the same code problem
i am working on this 5 days and it does not work
thanks 4 the help
5 Likes
You must define variable enemy.
local enemy = hero:findNearestEnemy()
3 Likes
man it does not work i,am using this code
code while true do
hero:moveRight()
hero:moveUp()
hero:moveRight()
local enemy = hero:findNearestEnemy()
hero:attack(enemy)
hero:attack(enemy)
end
help me man
thanks:relaxed:
3 Likes
Did you try the if statement. Sometimes there is no enemy and enemy is null so the code fails
3 Likes
there are 3 enemies man:smiley:
3 Likes
What level is this on? I want to test this out. There is no level called the last kithof in the game.
3 Likes
its in the first dungeon man
3 Likes
I know. Kithgard Dunegon is the World Name. I want the Level Name
(Example: Dungeons of Kithgard)
3 Likes
The level is called The Final Kithmaze FYI.
Now to the code itself, your code is 100% correct so far.
After you attack, but still inside the loop, you need add a couple of move commands.
(I’ll give you a hint. After you attack, you must have three more move commands. Try a combination of moveDown and moveUp and eventually you’ll get the solution (do not try moveRight or moveLeft)). This should be a big enough hint but if you still need help, tell me man.
2 Likes
can you give me the good code man:sunglasses:
2 Likes
Bro, you cant ask for the code. This is supposed to be a learning game, and the point is to find the answer. BTW, I accedentally did the same thing once, so your not the only one.
4 Likes
True, but the code I gave him was just a little help. He didn’t understand what I meant by a combination of move commands so I showed him. I think for these earlier levels, its ok to show them an example to help them grasp the concept. Its never OK to give out code, but I think a little hint like that follows the guidleines.
4 Likes
I was not talking about you @_TD_RodYT but @Benjamin_van_den_Bra
3 Likes
Ok Thanks I was confused. (20 Characters)
4 Likes
It is not that hard (20 characters)
1 Like
this is the code that i used that made it work
(solution removed)
@Christopher_Cardinal
Please don’t post solutions here. You will find this stated in many threads throughout this board. The purpose of Code Combat is to learn and force people to think. Simply providing the answers is not helpful and counter productive to the learning process. Please delete your post. Thanks.