Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

I need help,I forgot the distance method, i also need help on Rich Forager

help please

pls,someone

Can you be more spesific than just saying help.

1 Like

@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

1 Like

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]

4 Likes

yeah, I don’t think you can do that one until code book IV

1 Like

mhm. … yup (20charsssssssaleready)

i also needed help on rich forager

Make another topic on that.

2 Likes

@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.

1 Like

Oh, ok! sry about that.

1 Like

Can u show us ur code? plz format it 2

1 Like