Can't solve ogre-encampment [solved]


#1

Can’t solve this level.

Error:

Console output after pressing “Submit” button:

My code:

loop
    enemy = @findNearestEnemy()
    if enemy
        @attack enemy
        @attack enemy
    else
        @attack "Chest"

Btw, everything on the screen looks good. How to solve it correctly?


#2

Your code is fine, but there is a bug in our CoffeeScript transpilation process where it can’t handle nested if-statements instead loops like that. We’ll probably have our work cut out for us fixing it, too. For now I’d recommend playing the later levels in a language other than CoffeeScript, like Python.

Sorry about that!


#3

Thanks for answer, i switched to JavaScript and everything fine.