Help with level "Volcano fighters"


#1

Hi guys,
i have some troubles with level “Volcano fighters”. The error message is in line 34 (hero.moveXY): "reads only undefined arguments. I understand the error message, but I don’t know what I could change. I think there might be another error, but I just can’t find it. Can some help me? Thanks a lot!

# Complete the paladin rectangle to protect the village.

# This function finds the left-most unit.
def findMostLeft(units):
    if len(units) == 0:
        return None
    mostLeft = units[0]
    for unit in units:
        if unit.pos.x < mostLeft.pos.x:
            mostLeft = unit
    return mostLeft

# This function finds the bottom-most unit:
def findMostBottom(units):
    if len(units) == 0:
        return None
    mostBottom = units[0]
    for unit in units:
        if unit.pos.y < mostBottom.pos.y:
            mostBottom = unit
    return mostBottom

paladins = hero.findByType("paladin")
# Find the top left paladin with findMostLeft function:
topleftpaladin = findMostLeft(paladins)
# Find the bottom right paladin with findMostBottom function:
toprightpaladin = findMostBottom(paladins)

# Use X coordinate from the top left paladin:
# and Y coordinate from the bottom right paladin:
x = topleftpaladin.x
y = toprightpaladin.y
# Move to the {X, Y} point from the previous step:
hero.moveXY(x, y)
# Continue to shield while the volcano is erupting:
while True:
    hero.shield()

#2

You need the word “pos” in between the method and the letter_pos.
topleftpaladin.pos.x
Do the same for the variable y.

The reason you need to use the word “pos” is because topLeftpaladin is reffering to a unit. If you wanted to you could also change the return statements in the methods and have them say. return mostBottom.pos. That would allow your other statements to work.


#3

Vielen Dank für Ihre Nachricht! Leider bin ich vom 24.März bis zum 28.März 2017 nicht im Büro. In dringenden Fällen wenden Sie sich bitte an Karoline Tielke, karolinetielke@klax-online.de

Mit freundlichen Grüßen
Christian Engelbrecht

Thank you for your mail. Unfortunately I’m not in the office from 24 of march to 28 of march 2017 In urgent cases please contact Karoline Tielke, karolinetielke@klax-online.de