[SOLVED] Giant Shield Python Please Help

Here’s my code:

# Use shieldBubble to extend your shield and get to Nalfar.
def CommandPaladin(paladin):
    hero.command(paladin, "move", hero.pos)
paladins = hero.findByType("paladin")
for paladin in paladins:
    if paladin:
        while True:
            hero.moveXY(hero.pos.x + 1, hero.pos.y)
            CommandPaladin(paladin)
            hero.shieldBubble()
            

I can defeat Nalfar, but the paladin always died.

The for-loop is unneeded, as the paladin is the only friend.

paladin = hero.findFriends()[0]  # 0 is the first AND only friend of the array
def CommandPaladin():  # You don't need a parameter
    hero.command(paladin, "move", hero.pos)

while True:
    hero.move({'x': hero.pos.x + 1, 'y': hero.pos.y})  # use 'move', so you can
    # move and command at the same time
    CommandPaladin()
    hero.shieldBubble()

Yes, or you can do shieldBubble() before commandPaladin function and it also will be success.

2 Likes

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.