I just finished building the level that teaches you how to use while loops. Could someone try it out? http://codecombat.com/play/level/coin-mania?dev=true
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
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
Thanks.
Iâll just update the level and add the points that you mentioned.
@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.
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).
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?
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.
Excuse me, why > 50 ?
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.
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()
.
I think itâs because itâs an old level, so it doesnât work any more.
-Danny
Oh, I remember you!!