Help! I need help solving Backwoods Fork! [Solved]

Please help. i have no idea what to do here.

Use the checkAndAttack function to make your code easy to read.

This function has a parameter.

An parameter is a way of passing information into a function.

def checkAndAttack(target):
# The ‘target’ parameter is just a variable!
# It contains the argument when the function was called.
if target:
hero.attack(target)
hero.moveXY(43, 34)

while True:
hero.moveXY(58, 52)
topEnemy = hero.findNearestEnemy()
# Using the checkAndAttack function with the topEnemy variable.
checkAndAttack(topEnemy)

# Move to the bottom X mark.
hero.moveXY(58, 16)
# Create a variable named bottomEnemy and find the nearest enemy.

# Use the checkAndAttack function, and include the bottomEnemy variable.

Here. read the comments. they say to create a bottom enemy variable.
use:

# Create a variable named bottomEnemy and find the nearest enemy. 
bottomEnemy=hero.findNearestEnemy()
checkAndAttack(bottomEnemy)

i’m aware. i tried to do that. it didn’t work.

Could yøu show your code?

@Lavernius_Tucker Sometimes you need to watch indentations. That seems to be most peoples problem.

Move to the bottom X mark.

hero.moveXY(58, 16)
# Create a variable named bottomEnemy and find the nearest enemy.
checkAndAttack(target)

# Use the checkAndAttack function, and include the bottomEnemy variable.

i tried deleting, adding indentations, nothing i’ve tried works.

    # Move to the bottom X mark.

For this find the x and y coordinate for the bottom x mark and do: hero.move(x,y)

# Create a variable named bottomEnemy and find the nearest enemy.

for this part type in bottomEnemy = hero.findNearestEnemy()
You do the equal part since its easy to find.
Hint: It is in the place where it say’s glasses or lenses. It should be below your weapon.

Thank you @thebagel @098765432123 @Ryan_Wong for helping him/her!!

# Use the checkAndAttack function, and include the bottomEnemy variable.

This part write CheckAndAttack(BottomEnemy)
you will do the part in the parentheses because it is very easy since they tell you what to include in the parentheses in the hint they give you.

he/her didn’t reply yet but I gave he/her three tips that should help he/her get through the level since when I did this level I had almost the same code but I think he/her is only leaving out the bottom 3 line of code.

thank you all. especially @Ryan_Wong

1 Like

is still broken. now i run out of time…

Can you show your code?

Use the checkAndAttack function to make your code easy to read.

This function has a parameter.

An parameter is a way of passing information into a function.

def checkAndAttack(target):
# The ‘target’ parameter is just a variable!
# It contains the argument when the function was called.
if target:
hero.attack(target)
hero.moveXY(43, 34)

while True:
hero.moveXY(58, 52)
topEnemy = hero.findNearestEnemy()
# Using the checkAndAttack function with the topEnemy variable.
checkAndAttack(topEnemy)

# Move to the bottom X mark.
hero.moveXY(58, 16)
# Create a variable named bottomEnemy and find the nearest enemy.
bottomEnemy=hero
# Use the checkAndAttack function, and include the bottomEnemy variable.
checkAndAttack
hero.moveXY(43, 34)

should be bottomEnemy = hero.findNearestEnemy()

and this should be checkAndAttack(bottomEnemy)

@Lavernius_Tucker can you indent it correctly?

it is indented properly

def checkAndAttack(target):
# The ‘target’ parameter is just a variable!
# It contains the argument when the function was called.
if target:
hero.attack(target)
hero.moveXY(43, 34)

while True:
hero.moveXY(58, 52)
topEnemy = hero.findNearestEnemy()
# Using the checkAndAttack function with the topEnemy variable.
checkAndAttack(topEnemy)

# Move to the bottom X mark.
hero.moveXY(58, 16)
# Create a variable named bottomEnemy and find the nearest enemy.
bottomEnemy=hero
# Use the checkAndAttack function, and include the bottomEnemy variable.
checkAndAttack
hero.moveXY(43, 34)