Can somebody help me? I don't get this

He doesn’t collect coins.

Some of your code after var totalCoins = 0; should be in a loop. A break statement is pointless if you’re not in a loop.

You also have if( <= 30) { break; }. This means that, even with a loop, you’re not going to break out at the proper time. Try > 30 instead.

Where do I break it???

You want to break the second while(true) loop when > 30. The reason why is that the first loop was supposed to take 15 seconds, so if we want this loop to take another 15 seconds, we need to break when the game time is at 15+15=30.

There should be three while(true) loops in your code. Right now there are two. The first one will break when > 15, second when > 30, and the third when > 45. The missing while true loop will go underneath the line var totalGold = 0;

tayler are you here??

I don’t have time to figure out what’s wrong at the moment - I’ll check it in a bit if you don’t figure it out on your own. Try piecing it out - just try to make one part (of the 3 while loop codes) work, then try another.

Ok, here are the changes that need to be made. The first time your hero says defeated, , you moved to 59, 33. You need to do that for the other two times as well. As far as I know, you need to know the amount of coins collected, not the amount of gold collected. Therefore, you should change totalGold += coin.value; to totalGold += 1; or you could change it to totalGold++;

Thanks, but I actually figured it out. :smiley:

1 Like

Great, figured you would if given time. :wink: