Help with backwoods fork

i have already solved this one now but thanks

can any body help me

1 Like

Hi Ritic-the-Cold,

Welcome to the forum. We’d be happy to help you!

Can you post your current code, and a bit of a description about what is/isn’t happening when you run it.

There’s instructions on how to format your code here.

Jenny

1 Like

this is my code
def checkAndAttack(target):
# The ‘target’ parameter is just a variable!
# It contains the argument when the function was called.
if target:
enemy = hero.findNearestEnemy()
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.findNearestEnemy()
# Use the checkAndAttack function, and include the bottomEnemy variable.
checkAndAttack(topEnemy)

Hi @Ritic-the-Cold, your code still isn’t formatted. Meaning it doesn’t show the indentation (how far the lines are pushed in). I can see a problem however:

At the top x you attacked the top enemy, now you’re at the bottom x you should attack the bottom enemy. (you’ve got a variable for that!).
It could be an indentation problem however so please put three ``` on two lines, then make a space inbetween them and post your code directly from codecombat. If you just post it from your post it still won’t be formatted.
Thanks
Danny

Hello, i need help with this coding level.
each time i try and what i tells me it keeps on messing up and it goes up but not down. can you help me please.

Hello and welcome to codecombat discourse! This is a cozy forum where you can share ideas, share fan art, get assistance for code, etc! Before you proceed, we hope that you review this topic, which shows all essentials of this board! Thanks!

Ok well i did what it said exactly but is says i need to define the code, how do i fix it

where is your code that is properly formatted @Falcons118 wanna help out

I wont be able to help out unless its JS…

yeah true but she isnt telling me what language eithir

ok thank you so much of hellping me

okay and for your code

that is not formatted propperly

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.findNearestEnemy()
# Use the checkAndAttack function, and include the bottomEnemy variable.
 cheakAndAttack(bottomEnemy)

this is formatted properly and what are you wearing

while True:
    hero.moveXY(58, 52)
    Enemy = hero.findNearestEnemy()
    checkAndAttack(Enemy)
    hero.moveXY(58, 16)
    Enemy = hero.findNearestEnemy()
    checkAndAttack(Enemy)

try using this while true statement instead of

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.findNearestEnemy()
# Use the checkAndAttack function, and include the bottomEnemy variable.
 cheakAndAttack(bottomEnemy)

that should work if not tell @Egirl