help me with the hit and freeze this is the code i use
This function checks if the enemy is in your attack range.
distance = hero.distanceTo(enemy)
# Almost all swords have attack range of 3.
if distance <= 3:
Attack ogres only when they’re within reach.
# Find the nearest enemy and store it in a variable.
enemy = hero.findNearestEnemy()
# Call inAttackRange(enemy), with the enemy as the argument # and save the result in the variable canAttack. inAttackRange(enemy); # If the result stored in canAttack is True, then attack! hero.attack(enemy) pass