pls,someone
Can you be more spesific than just saying help.
@calvin you can look back at you previous levels. but here it is:
Python:
enemy = hero.findNearestEnemy()
distance = hero.distanceTo(enemy)
if distance <= 3:
hero.attack(enemy)
or JS:
var enemy = hero.findNearestEnemy();
var distance = hero.distanceTo(enemy);
if (distance <= 3) {
hero.attack(enemy);
}
I think that’s right. I just started working on JS today lol
And for the signs:
→ <= less than or equal to
→ == equal to
→ >= greater than or equal to
→ != not equal to
→ % modulous [if you don’t know this, ignore it]
yeah, I don’t think you can do that one until code book IV
mhm. … yup (20charsssssssaleready)
i also needed help on rich forager
Make another topic on that.
@thebagel it is fine if @calvin makes this a level help topic. So please go ahead and give us your code @calvin and make sure to press the </> before you do.
Oh, ok! sry about that.
Can u show us ur code? plz format it 2
# Use "if" and "else if" to handle any situation.
# Put it all together to defeat enemies and pick up coins!
# Make sure you bought great armor from the item shop! 400 health recommended.
while True:
flag = hero.findFlag()
enemy = hero.findNearestEnemy()
item = hero.findNearestItem()
if flag:
# What happens when I find a flag?
hero.pickUpFlag(flag)
elif enemy:
# What happens when I find an enemy?
hero.attack(enemy)
elif item:
# What happens when I find an item?
if (item) distance <=6:
hero.moveXY(item.pos.x,item.pos.y)
all you need to do is press submit, and use the flags in de bottom left corner to guide your hero to get all the coins.
Your code is perfect