Weird moving of the hero


#1

I cant understand what`s wrong with my hero moving code?

loop {
    //  Find coins and/or attack the enemy.
    // Use flags and your special moves to win!
    var items = this.findItems();    

    for (var a = 0; a < items.length; ++a) {
    
        var enemy = this.findEnemies();  
        if (enemy.length > 0) {
            for (var i = 0; i < enemy.length; ++i) {
                var enemy1 = enemy[i];
                this.attack(enemy1);
            }
        } else {
            var item = items[a];
            this.move({x: item.pos.x, y: item.pos.y});
        }
    }
}


#2

You need to be more descriptive. What is your hero doing?


#3

It’s the “move” method. it’s currently bugged. i recommend switching back to boots with moveXY


#4

This is a "multiplayer treasure grove"
My hero should collect coins and kill all enemies.


#5

He meant describe what was wrong with your heros movement. nonetheless i already gave you the answer. :slight_smile: