// Reach the end of the maze using move commands.
// Count how many gems you pick up, and then say the current count when near a fireball trap to disable it.
// The raven at the start will give you a password. Say the password near a door to open it.
// Defeat ogres when you get near them.
// You can use a loop to repeat all of the instructions as needed.
// If you beat this level, you can skip to the Forest World!
var password = “Abracadabra”;
var enemy = hero.findNearestEnemy();
hero.moveUp();
hero.moveRight();
hero.moveRight();
hero.moveRight();
hero.moveUp();
hero.moveDown();
hero.moveRight();
hero.say(password);
hero.moveRight();
hero.moveRight();
hero.moveUp();
hero.say(1);
hero.moveUp();
hero.moveUp();
hero.attack(enemy);
hero.moveLeft();
hero.moveLeft();
hero.moveLeft();
sry, I don’t have time right now, I’ll help you tommorow, and I think your code is right except the bottom part, add two or three more hero.moveLeft();
and add moveUp
Well let’s see what your code actually does. You store the password and you find the nearest enemy, good. Then you immediately tell your hero to move up. There’s a wall there, so he runs into it. He can only do what you tell him to do.
This level is supposed to be difficult because it allows you to skip the dungeon levels if you complete it, moving on to the forest. I think you’ll need to use loops to complete it in the correct amount of statements.
If you have problems, I suggest coding one line at a time and then running, instead of trying to code everything at once.
Sorry man but I’m like waaaaaaay past dungeon levels XD.
I’m just reviewing and I did do 1 or 2 lines of code a ran it everytime.
I don’t know if I want to go through the trouble of doing 1 line.
Your code is incorrect. Having your hero say 1 only works for the first iteration. If you read line 2 it tells you to keep count of how many gems you have picked up to disable the fireballs. You dont have any variables keeping track of your gems.
Im just guessing from looking at the pictures. Not only are you at the wall but the enemy is right next to you. Im under the impression you didnt finish the enemy. Hes the one dragging you back into the wall. I dont see any red dots leading back to the wall where your ending up. Try using the attack method twice. I dont know what sword your currently wearing but its not finishing the enemy in one hit.
How do you manage in one picture to have 2 enemies but walk right past them? In another picture you only have one enemy and he pushes you all the way back?
I understand you very well could get by with out counting your gems by inputing the correct number but you would go well over 30 statments.
Those are 2 different instances of code.
One picture involving a set of code that attacks the enemy and one that does not attack the enemy.
I am thinking something is wrong when I attempt to attack the enemy.
I would try that counting variable thing right now but I can’t remember how to do it.
I may eventually have review all the levels I’ve been through but right now I feel like spending time making my online portfolio.
Cause ultimately I want to do coding for a living.