Help: Ogre Invaders


I don’t really get what it means by “return the enemy x’s position”

Can I have a link please and listen to the instructions I think you do something with the robotwalker.

So basically it is telling you to first check if there is an enemy, if there is, then return enemy.pos.x (this is the enemy’s x pos). If there isn’t an enemy, then return -1.
Lydia

1 Like


I have this now, it says their x position but what do you mean by return -1?

the link to the level is ogre invaders but i can’t find it on the map

“what do you mean by return -1?” - Your function must return the x position of the enemy ( do not say it in the function) or -1 if there is no enemy
@bladee do you have a pet?

I figured it the problem do this

else:
        return -1
    pass

This should work this indentation might be wrong

To return something, you just do return (whatever you want to return)
Ex.
return enemy.pos.x
Lydia

The way I did it, worked so stick with that(I used pender without armor still worked :+1:)

I need help with this level I’m stuck on!!!

which level are you stuck on and also

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!

Ogre invaders @avery_witte

ok I don’t think have done that you know what is?

Thanks!
I’m currently stuck on Level 18

What is the name of the level, post your code, send a link, and format your code by pressing this button </>.

Are you talking to me? @milton.jinich

I do believe he was talking to you

u still there @Babygirl_77 ?

I can’t reply anymore

And now I can’t again…

while True:
hero.moveDown()
hero.buildXY(“fence”, 36, 34)
hero.buildXY(“fence”, 36, 30)
hero.buildXY(“fence”, 36, 30)
hero.moveRight()