this is mi code:
loop {
var enemy = this.findNearestEnemy();
var coins = this.findNearestItem();
var distance = this.distanceTo(enemy);
if (coins){
var pos = coins.pos;
var x = pos.x;
var y = pos.y;
this.moveXY(x, y);
}
else if (distance < 10){
this.isReady(“cleave”);
this.isReady(“cleave”);
}
}
I have an error on line 4 that says: "distanceTo target is null"
help me please, don’t know what it could be