I can't seem to figure out how to do the level Oasis. How do you do it?

I can’t find the code for the level Oasis.
Can you help me? loop:
x = self.pos.x
y = self.pos.y
enemy = self.findNearestEnemy()
if enemy and self.distanceTo(enemy) < 10:
# Move to the left by subtracting 10 from your X coordinate.
x = x - 10

else:
    # Move to the right by adding 10 to your X coordinate.
    x = x + 10
    self.moveXY(x, y)
1 Like

Well, give us your code so that we can help you. We are not omniscient; we do not know what your problem is. Don’t forget to read the FAQ to learn how to format your code.

2 Likes

I’m his brother and I know his problem. Though I don’t know how to solve it either.

Here is my code. It worked once but now it doesn’t.

loop:
# Use “if” to only move when a yak is less than 10m away.
enemy = self.findNearest(self.findEnemies())
if enemy:

    if self.distanceTo(enemy) < 10:
        x = self.pos.x + 10
        y = self.pos.y
        self.moveXY(x, y)

You need to move to the left if the closest Yak is too close.

1 Like

Why do you always say the community isn’t omniscient or omnipotent, it’s just a really funny thing to say!

@ARasberrypy-thon Unfortunately, several people that ask for help do not realize that they also need to help us help them.

Very easy to argue, yeah.

how tho???(sorry i have to make this relley long cos athor wise it dos’int let me)

serg is not active now i would recommend you make a topic asking for help

Hello

You can also refer Converting modals from legacy controllers to new DModal component API - Developer Guides - Discourse Meta

Thank you
gregbowers

Hi @gregbowers , welcome to the Discourse! :partying_face: This is a friendly place to chat and ask for help on CodeCombat levels (remember to format your code correctly). Before you continue, don’t forget to read the guidelines here if you haven’t already.
We hope you enjoy your time here! :tada:


Thank you for trying to help, but the user you replied to hasn’t been active for 8+ years, and that link doesn’t seem relevant to the topic.

There are always new posts in which you can try to help other users though, like the following:

1 Like