Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

[SOLVED] Bash 'Em All - speed problem

#1
while True:
    
    enemy = hero.findNearestEnemy()
    if enemy:
        hero.bash(enemy)
        
    item = hero.findNearestItem()
    if item:
        hero.moveXY(item.pos.x, item.pos.y)
#2

I got an issue here, hero runs, bashes the ogre, the dude goes flying above and beyond the minefield, (without exploding the field). Hero then targets the gems and goes towards it, exploding the mine field, sending our unfortunate hero in orbit…

#3

Hi Giannis.
The problem is you’re running towards the item too soon after bashing the enemy.
Think about what would happen if you just let the enemy run towards you from behind the minefield? (When you were a safe distance away of course)
I hope this helps.
:lion: :lion: :lion:

#4

hey, thanks for the reply DP,
im messing around with the distance option still trying to make it work,
somewhere i read there is a hero.wait or some command like that, is that something vaild? havent come across it

#5

The hero.wait() method is available with certain wristwatches. An upgrade to your equipment can get you that ability.

#6

This is the one…

#7

You can pass the level with the absolutely minimal equipment. No books, no glasses, only Crude Spike shield and Sundial Wristwatch I think is obligatory with hero.isReady(“bash”)

#8

Thanks for all the helpful posts, they were indeed what i needed to finish the level.