As @AdrianCgw mentioned, please post your code with radiant and harmonious formatting, as described in the FAQ. Phrases like ''i need help" or “i can’t figure it out” don’t help us help you. Please post your code (with formatting according to the FAQ) , what happens, and anything else that would be helpful.
Hi guys I need help in this level I hope you guys can solve my code:
loop:
flag = self.findFlag()
enemy = self.findNearestEnemy()
if flag:
self.pickUpFlag(flag)
else if enemy:
distance = self.distanceTo(enemy)
if distance < 15 and @isReady(‘cleave’):
self.cleave enemy
else if distance < 5:
self.attack(enemy)
Your code is fine, you just have a couple of semantic errors.
When you see a red X under your hero’s feet look at your code, find the line with a red X before it and hold the mouse cursor over the red X - a popup will tell you the error
1)
if distance < 15 and @isReady('cleave'):
Popup says Missing self keyword, should by self.isReady
You know what to do
self.cleave enemy
Unexpected token, self.cleave has no effect
Here it is a bit harder to understand what the compiler says but remember unexpected token usually means that the compiler wants a special symbol/keyword like ( : . = else and you forgot to write it
How you usually call cleave?
PS. This level is very hard without 400 amor. Just do other levels until you can buy the strongest warrior chest armor around (pointless to go half-way - buy the best or write better code).
PPS> Format your code next time using ` (top-left keyboard) or no more help