could someone tell me what is wrong and why my guy wont move when I place the flag (java script)
// Use “if” and “else if” to handle any situation.
// Put it all together to defeat enemies and pick up coins!
// Make sure you bought great armor from the item shop! 400 health recommended.
loop {
var flag = this.findFlag();
var enemy = this.findNearestEnemy();
var item = this.findNearestItem();
if (flag) {
// What happens when I find a flag?
this.pickUpFlag(flag);
}
else if (enemy) {
// What happens when I find an enemy?
this.attack(enemy);
}
else if (item) {
// What happens when I find an item?
item = this.findNearestItem();
this.move(item.pos);
}
}