[SOLVED] The Final Kithmaze Code Combat


#1

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 :rage::smiley::smiley::smiley:

thanks 4 the help


#2

You must define variable enemy.

local enemy = hero:findNearestEnemy()

#3

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:


#4

Did you try the if statement. Sometimes there is no enemy and enemy is null so the code fails


#5

there are 3 enemies man:smiley:


#6

What level is this on? I want to test this out. There is no level called the last kithof in the game.


#7

its in the first dungeon man


#8

I know. Kithgard Dunegon is the World Name. I want the Level Name

(Example: Dungeons of Kithgard)


#9

the last kithhof man


#10

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. :wink:


#11

can you give me the good code man:sunglasses:


#13

thanks man love it :smiley:


#15

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.


#16

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. :smiley:


#17

I was not talking about you @_TD_RodYT but @Benjamin_van_den_Bra


#18

Ok Thanks I was confused. (20 Characters)


#19

sorry :grin:
:sweat_smile:


#21

It is not that hard (20 characters)


#22

this is the code that i used that made it work

(solution removed)


#23

@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.