Desert Combat: Help! What's wrong with my code?


#1

ordersGiven = 0
enemy = self.findNearest(self.findEnemies())
while ordersGiven < 5:
self.say(“Attack!”)
x = self.pos.x
y = self.pos.y - 10
self.moveXY(x, y)
ordersGiven = ordersGiven+1.

while ordersGiven>=5:
enemy = self.findNearest(self.findEnemies())
hero.findEnemies()

self.moveXY(51, 32)
self.shield()
self.shield()

self.cleave(enemy)
self.attack(enemy)
self.cleave(enemy)
enemy = hero.findNearestEnemy()
hero.attack(enemy)
self.shield()

I don’t get what’s wrong with this code. It just stands there after we attack the gate


#2

Cooldown for cleave is 10s - your hero just stand here for 10s.


#3

Thanks @juraj_pechac . Will try to improve it