Help with stillness in motion level? LUPA programming language


Im stuck on this level and i cant get passed it

I am using LUPA as my codes

heres my code…

    local enemy = self:findNearestEnemy()
    if enemy then



Can someone give me a code for this?


Hello, LearningCodes, and welcome. Please read the FAQ and learn how to format your code properly prior to your next post. I’ve done it for you this time, but do so yourself in the future.

Here on CodeCombat, we don’t give out code as a regular policy. This game is intended to teach you coding. You don’t learn from just getting the answers.

Just telling us things like “I need help!” or “This code doesn’t work!” are not helpful to us. It is better to go into detail about your problem. However, here is what I can see:

You appear to only have one end in your code. You need an end for a loop and one for the if-statement. That appears to be your problem.


@ChronistGilver My problem now is i cant stay clear of the orgs that are there.:unamused:


ChronistGliver! Why don’t you hand us the code?


Scroll up a bit and you will get your answer:


I type in this code

enemy = self.findNearest(self.findEnemies())
# If there is an enemy, then…
if enemy:
# Create a distance variable with distanceTo.
distance = self.distanceTo(enemy)

    # If the distance is less than 5 meters, then attack.
    if distance > 5:
    # Else (the enemy is far away), then shield.
# Else (there is no enemy)...
    # ... then move back to the X.
    self.moveXY(40, 34)

But the headhunters still are able to attack me. I did what they said will you please point ot the problems with this code.

# If the distance is less than 5 meters, then attack.
    if distance > 5:

You mixed the comparison signs. This is a less than b:

a < b


What is wrong with my code