Rich forager could someone tell me what is wrong and why my guy wont move when I place the flag (java script)


#1

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);
}

}


#2

I may not be right. But I thing you nead to take item.pos out of

this.move(item.pos);

And replace it with;

this.move(this.move X, this.move Y);

For you @hiiiiiiiiiii and others who may see this, please don’t think I’m a idiot if this is completely wrong. I’m not used to the javascript programming language. I’m more adapt to python.
Thanks Cheers!:beers: