Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Help: Hit and Freeze

i just moved on from the level before this and I started of really well and when I did the cleave attack to the ogres they all get knocked out but one and I fail it somehow.

# You are trapped. Don't move, it'll be painful.

# This function checks if the enemy is in your attack range.
def inAttackRange(enemy):
    distance = hero.distanceTo(enemy)
    # Almost all swords have attack range of 3.
    if distance <= 3:
        return True
        return False

# Attack ogres only when they're within reach.
while True:
    # Find the nearest enemy and store it in a variable.
    # Call inAttackRange(enemy), with the enemy as the argument
    # and save the result in the variable canAttack.
    # If the result stored in canAttack is True, then attack!

is this what your supposed to do? Try to read the comments carefully.

how do i store the nearest ogre in an variable then?

ogre = findNearestEnemy

i will reply to yall tommorow i need to go do something but thanks