Thombush Farm coffescript help?


#1

Here’s my code:

    @moveXY 43, 50
    topEnemy = @findNearest(@findEnemies())
    if topEnemy
        @buildXY 'fire-trap', 43, 50
    @moveXY 25, 34
    leftEnemy = @findNearest(@findEnemies())
    if leftEnemy
        @buildXY 'fire-trap', 25, 34
    
     @moveXY 43, 20
    bottomEnemy = @findNearest(@findEnemies())
    if bottomEnemy
        @buildXY 'fire-trap', 43, 20
    

It gives me “Syntax error on line 17: indentation is ambiguous”


#2

Possibly your @move 43, 20.


#3

What about it? What should I fix?


#4

Well, the error you get is “Indentation is ambiguous”.
The @move is slightly indented.

I lean out of the window and say this is probably where your problem is.


#5

Alright. Thanks J_F_B_M.


#6
     @moveXY 43, 50
topEnemy = @findNearest(@findEnemies())
if topEnemy
    @buildXY 'fire-trap', 43, 50
@moveXY 25, 34
leftEnemy = @findNearest(@findEnemies())
if leftEnemy
    @buildXY 'fire-trap', 25, 34

@moveXY 43, 16
bottomEnemy = @findNearest(@findEnemies())
if bottomEnemy
    @buildXY 'fire-trap', 43, 20
@moveXY 44, 36

I fixed it, but it says I have the goals incomplete.


#7

Ok, it’s fixed. I added a loop element.