- Szczegóły
- 2292
// The hero is all confused!
// Correct their path so they don't walk on the mines.
hero.moveXY(11, 36);
hero.moveXY(35, 25);
// The hero is all confused!
// Correct their path so they don't walk on the mines.
hero.moveXY(11, 36);
hero.moveXY(35, 25);
// Navigate through the woods, but be on the lookout!
// These forest cubbies may contain ogres!
hero.moveXY(19, 33);
var enemy = hero.findNearestEnemy();
// The if-statement will check if a variable has an ogre.
if(enemy) {
hero.attack(enemy);
hero.attack(enemy);
}
// Collect all the gems in 4 moveXY's or less!
// Programmers need to think creatively!
hero.moveXY(21, 24);
hero.moveXY(56, 61);
hero.moveXY(56, 23);
hero.moveXY(32, 48);
// Uwaga, gdzieś tu krąży Łowca Głów!
// Ruszaj się wokół zagajnika, aby być poza zasięgiem wzroku Łowcy Głów.
while(true) {
hero.moveXY(56,44);
hero.moveXY(40,56);
// Użyj "moveXY" by krążyć wokół zagajnika i przeżyć.
hero.moveXY(24, 44);
// Pokonaj ogry w ich własnym obozowisku!
while(true) {
var enemy = hero.findNearestEnemy();
// Użyj instrukcji warunkowej "if-statement", by sprawdzić czy wróg się pojawił:
if (enemy) {
// Zaatakuj wroga jeśli się pojawił:
hero.attack(enemy);
}
}
// Zapamiętaj że wrogowanie nie muszą w tym momencie istnieć.
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
// Jeżeli jest tu wróg , zaatakuj go!
hero.attack(enemy);
}
}
hero.moveXY(24, 42);
var enemy = hero.findNearestEnemy();
if(enemy) {
hero.attack(enemy);
hero.attack(enemy);
}
hero.moveXY(27, 60);
enemy = hero.findNearestEnemy();
if(enemy) {
// Attack the enemy if it exists!
hero.attack(enemy);
}
// Remember that enemies may not yet exist.
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
// If there is an enemy, attack it!
hero.attack(enemy);
}
}