Help with code in Stillness in motion


#1

I changed it…

loop {
this.shield();
enemy = this.findNearestEnemy();
if (this.isReady(“cleave”))
(this.cleave(enemy));
else {
this.shield();

}
}

but I still end up dying,
help?


#2

Hello, lolfrog, and welcome. Please format your code correctly according to the FAQ.

The comments say to attack if the opponent is less than ten meters away. Try doing that.


#7

loop:

flag=self.findFlag("green")
if flag:
    self.pickUpFlag(flag)
else:    
enemy = self.findNearestEnemy()
# If there is an enemy, then...
if enemy:

    # If the enemy is less than 5 meters away, then attack()
    distance=self.distanceTo(enemy)
    if distance < 5:
        if self.isReady("cleave"):
           self.cleave(enemy)
        else:
            self.attack(enemy)
        
    else:    
    # Otherwise (the enemy is far away), then shield()
    pass
    self.shield()
    
    

# Otherwise (there is no enemy...)
else:
    # then move back to the X
    self.moveXY(40, 34)

#8

…Okay, there’s some code. What do you want us to do with it?


#9

¿ It the most optimal ?


#10

If it works, then it’s fine.


#11

Can you tell me a code ?


#12

If you are asking for the solution, I will not give you a solution code. We like to encourage people to find the solution for themselves. If I told you the solution, it is all too likely that you will be back asking for the solution to the next level. And then the next.

On the other hand, if you are asking for help, I need you to tell me what problems you are encountering in your code.


#13

You Can Pass unused flags level ?


#14

Yes, I suppose I can.


#15

what kind of code are you using?


#16

I believe that Jorge_Lagos_Duarte was using python.


#17

Here! Just use Python and remember to have a shield! :wink:

[redacted, we do not post correct code]


#18

We don’t post correct code here on CodeCombat, especially if it’s not formatted properly.


#20

no problem brother:watch: I also had problems with this level no need to be mad


#21

Hey brother how do you do the last level brother yeah brother


#22

self.moveRight()

self.moveDown()
self.moveRight()
yeah this is the code brother


#23

cool brother I was stuck on the first level


#24

yeah me to but you gave me the code brother do you not remember brother?


#25

oh yeah that one time in that one place! I remeber the code thanks brother