Hey there, I am using Javascript and kind of got stuck on the level ‘Drop The Flag’. The solutions I found so far don’t work for me, since either some people forgot to press the submit button, which I never did, or wrote a wrong code, which I think I didn’t. ^^
My code:
while(true) {
var flag = hero.findFlag();
if (flag) {
// Wie bekommt man flagX und flagY von der Flaggenposition?
// (Schaue weiter unten, wie man x und y von Gegenständen erhalten kann.)
var flag = flag.pos;
var fX = flag.x;
var fY = flag.y;
hero.moveXY(fX, fY);
hero.buildXY(“fire-trap”, fX, fY);
hero.pickUpFlag(flag);
}
else {
var item = hero.findNearestItem();
if (item) {
var itemPos = item.pos;
var itemX = itemPos.x;
var itemY = itemPos.y;
hero.moveXY(itemX, itemY);
}
}
}
However, I am not able to place flags. Yes, I know I have to click ‘Submit’ for the flags to work, I do that every time…
Here’s what I do:
I click on ‘Submit’. Then, I click on one of the three flag icons in the left corner. Finally, when I go back to the map, I can actually see a transparent flag and can move it around, but are not able to place it down by clicking with the mouse.
Windows 10, Newest Firefox Version.
There shouldn’t be a problem unless my code is wrong. Do I miss something very obvious right here? I don’t get it.
EDIT: Sorry for not formatting the post, it’s aweful to read. This is my first post, I thought it would do that automatically.