This exact code has been working all through the game. Now it is not and i am getting a “TypeError”.
TypeError: hero.attack is not a function
Annoying errors like this are not a part of the course and should not even exist if there is no hint on how to solve it.
Here is a screenshot of the exact code in another level with no problem
Now the same in this level
Well, you have equiped a hammer, not a sword so it is normal to not be allowed to attack.
OK i see, i can’t “attack” because that action belongs to something i can do with a specific weapon, sword. But i can “cleave” because that action belongs to the hammer. I can also set fire traps. ok so the point here of this level is to understand all the ways you can hurt the enemy not specific to one weapon. such as luring them to a trap, etc.
But what else could i be missing? if i am supposed to fight them in a duel, i can’t imagine all i can do is just trick them to following me into something. the documentation in the middle panel is not very helpful.
If you fight against the AI, you should know that it has the same equipment as you do, so try to outsmart it. And after you beat the AI, you will be able to compete against other people (and some of them have a really billant code).
Uhm, I don’t think that hero can cleave with hammer. I really doubt hammer has this ability.
I would have to agree…it has only two methods:
oops, i only assumed i could cleave since i was not getting an error like i did with attack. i was wondering why i would not cleave. so pretty much all i was able to do earlier was build fire traps but that killed both of us lol.
ohhhhhhh wow, that was way easier than i thought, i killed it in 3 moves. the trick was to get out of the paradigm of attacking with a sword, then focus on only coding the movement to test how the enemy moved, THEN build the trap once the movement is clear.
interesting exercise to show us how focusing on old paradigms obscures simple answers.
Now you can compete against other people’s codes. Good luck!
How do you make Fire Traps? I just can’t seem to get it right!
Fire traps are planted by hero if you equipped with hammer.