Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

Stillness in Motion Python

    enemy = self.findNearestEnemy()
    if enemy:
        self.distanceTo(enemy) < 5
    if enemy:
        self.distanceTo(enemy) > 5
        self.moveXY(40, 34)

This is my code for Stillness in motion. I have no clue what is wrong but it’s not working. Sorry if it’s not formatted right but I’m short on time and am in ICT class at school. If someone could lend a hand that’d be great.


The discourse FAQ specifically says “Read Before Posting”. If you didn’t read the FAQ, then you shouldn’t be posting. I will do it for you this time, but don’t post again until you have read the FAQ.

I’ll go through your code line by line:

Line 4: self..distanceTo(enemy) < something returns a boolean that states whether it is true or not. This should be an if-statement.

Line 7: See line 4.


What do you mean by it should be an if-statement. I have if enemy: as my if, but I end up walking over to the head hunters instead.


@ChronistGilver means instead of:

if enemy:
self.distanceTo(enemy) < 5:

It would turn into:

if enemy and self.distanceTo(enemy) < 5:


I finally got it. Thank you so very much.


I still don’t under stand i’m stuck in the whole thing my guy keeps leaving his area


NM Chronist made sence and helped me thank


Have you fixed it? If not please explain the situation more clearly, take your code from the game and post it into the discourse (formatted as stated in the FAQ (search FAQ on the discourse search bar))
and maybe also a screenshot.
Thanks :lion: :lion: :lion:


I think he did, it was good he Solved it


k, (20 charactersAhheyy)


hey id like to ask how to get to the FAQ