// Get to the oasis. Watch out for new enemies: ogre scouts!
// Go up and right by adding to your current X and Y position.
var enemy = this.findNearestEnemy();
loop{
if (enemy) {
this.moveXY(x, y);
}
// Attack any enemies you see, or keep moving up and right.
var x = this.pos.x + 10;
var y = this.pos.y + 10;
else {
if (this.isReady("cleave")) {
this.cleave(enemy);
}
else if (enemy){
this.attack(enemy);
}
oh I get it but my player still won’t attack it just goes to the oasis
// Get to the oasis. Watch out for new enemies: ogre scouts!
// Go up and right by adding to your current X and Y position.
var enemy = this.findNearestEnemy();
if (enemy){
var distance = this.distanceTo(enemy);
}
loop{
if (!enemy) {
var x = this.pos.x + 10;
var y = this.pos.y + 10;
this.moveXY(x, y);
// Attack any enemies you see, or keep moving up and right.
}
else if (distance < 10) {
if (this.isReady(“cleave”)) {
this.cleave(enemy);
}
else {
this.attack(enemy);
}
}
enemy is always null, as it’s not being updated in the loop.
Also protip: cleaving scouts with the Long Sword is somewhat useless, as it takes too long and doesn’t inflict a lot of damage on the scouts. (Normal attack is fine, though.)