It’s been a while since I’m trying to pass through “Hold the forest pass” and other levels, that requieres the asignment of some var; and everything is good there, but when I’m giving the var an attribute like pos, it say that I should try “hero.pos”, whereas that is not the thing I’m looking for, which I’m trying to asing is an targetPos.
This is the code, that i’m trying to use to asing the x, y position (for items, flags, and other), but I it keeps println : Try “hero.pos”, “Cannot read property “pos” of null”.
_ var blackFlag = hero.findFlag(“black”);_
_ var blackFlagPos = blackFlag.pos;_
_ var bFX = blackFlagPos.x;_
_ var bFY = blackFlagPos.y;_
@Sniparth are you using hero.pos
or hero.pos.x
and hero.pos.y
For instance pos
is an object that has an x and y component.
Example:
pos = {x:20,y:34}
Try using hero.say() to determine the values:
hero.say(hero.pos);
hero.say(hero.pos.x);
Also check to determine if there is a flag.
For instance:
if (blackFlag) {
hero.say("Flag exists");
}
and
if (blackFlagPos) {
hero.say("Flag pos exists");
}