// Coins here disappear after a few seconds!
// Get all the gold coins before they vanish.
while(true) {
var closestGold = null;
var minGoldDist = Infinity;
var coinIndex = 0;
var coins = hero.findItems();
// Find the closest coin that is gold.
// Remember that gold coins have a value of 3.
while (coinIndex < coins.length){
var coin = coins[coinIndex];
var distance = hero.distanceTo(coin);
if (coin.value == 3 && distance < minGoldDist){
//here make closestCoin to be coin
//here make minGoldDist to be distance
}
coinIndex++;
}
if(closestGold) {
// Now go to the closest gold coin and get it!
hero.moveXY(closestGold.pos.x,closestGold.pos.y);
}
}
I think the placeholder in java is return;
Here do what the comments I gave you tell you to do.
Andrei
here you need
closestCoin = coin
minGoldDist = distance
i think this is what @AnSeDra was trying to tell you about.
That’s right!
Andrei
does it work @Monsty?
Thanks a lot @AnSeDra and Oliver!!!
No problem! And congratulations for completing the level!
Andrei
closestGold = coin;
minGoldDist = distance;
(as @AnSeDra would say) No problem! And congratulations on competing the level!
Now I need help on 3 more levels.
It’s ok though I’ve finished (more than) enough for today!!
I’m supposed to do 3 levels a day
Why are you supposed to do 3 levels per day?
Andrei
My dad told me to(20)
Oh, ok. I was doing a lot of levels per day because I love this game.
Andrei
Me too!!!(20)
Ok. We all might love Code Combat because it is such a good game that teaches informatics.
same here (20 chars)!!
Let’s now stick to the topic’s meaning that is the level Mad Maxer Sells Out.
Andrei