Level: Coin Mania


#1

I just finished building the level that teaches you how to use while loops. Could someone try it out? :smile: http://codecombat.com/play/level/coin-mania?dev=true


#2

Hi. This level is good until you have to kill the ogre. When I try to it just auto kills Tharin. This happens without even seeing the ogre. The rest of the level great though!

Thanks,
TJ


#3

I think it’s a good level. Some remarks though.

  • Check for spelling/grammar errors, like ‘atleast’.
  • Talk about Tharin as a character,rather than an object. Don’t say ‘the tharin’.
  • Losing health by collecting coins? WAT? Just say Tharin is tired or something and he needs to replenish his health before fighting the ogre.
  • Tell the player he needs to be aware of poisonous mushrooms. In another level this mushroom is used to boost Tharin’s power and make him grow (like in Super Mario), and it might confuse people here. It did for me, and i think that’s the problem that @makertech81 is having.
  • Maybe add an article to the guide sometime in the future.

Greetz,

Jasper


#4

Thanks.
I’ll just update the level and add the points that you mentioned.


#5

@makertech81 i think you ate the mushroom. I’m sorry I didn’t mention the function of the mushroom here. It decreases your health and it might even kill you. I have updated that in the level.
Thanks.


#6

Yup, it would be good to add a level-specific Guide article (with name “Overview”) with some particular hints about the level. Also, the “Zoom In” script duration should probably be like 1000ms or less instead of 4000ms (it seemed like there was a bug).


#7

I’m having a problem in this level. After collecting 40 gold, all the potions and neither of the mushrooms, I use a loop to make Tharin walk left as long as the distance to the nearest enemy is greater than 10, as 10 is the range of attackNearbyEnemy, and then attack. The problem is that he keeps walking right through the ogre before he decides to stop and attack, by which point he has been killed.

while(this.gold<40)
{
    this.moveRight();
}
this.moveUp();
this.moveUp();
while(this.health<70)
{
    this.moveRight();
}
while(this.health>5)
{
    if(this.distance(this.getNearestEnemy())<=10)
    {
        this.attackNearbyEnemy();
    }
    else
    {
        this.moveLeft();
    }
}

What am I doing wrong?


#8

Hi olorin_aiwendil.

Can you try to change the second while loop?

The idea is to stop walking when you are near the enemy.

You can use that:

while (this.distance(this.getNearestEnemy() > 50) {
this.moveLeft();
}

this.attackNearbyEnemy();

I hope this helps.


#9

Excuse me, why > 50 ?


#10

Thank you, that did the trick. I kept using comparing distances to 10 in all my methods because that’s what the guides state as the range of attackNearbyEnemy; turns out it’s not. My mistake.


#11

I think it’s also happening because of this issue, which I hope to fix soon. Basically, when you call other methods, Tharin repeats the last action, so he ends up continuing to try to moveLeft() each time he checks getNearestEnemy() and distance().