[Adventurer] Perilous Passage

The Mountain level Perilous Passage is ready for testing!

This level demonstrates property assignment and eventually will build off of a series of levels teaching about peasant building.

3 Likes

I like how you made the map.

1 Like
if hero.isPathClear(friend.pos, enemy.pos):

1 Like

line 19: enemy[“accountedFor”] = True; has a semi-colon at the end
(removed in patch)

completed without issue in Javascript mode

added LUA patch

1 Like

Two new concepts at the same time in this level. Learning new things is definitely desired, but might be confusing at the stage. Even I (being a CC “veteran”) was a bit “surprised” by these:

  • assigning a new property to an existing object:
    friend["startPos"] = {"x": xPos, "y": yPos} and enemy["accountedFor"] = True

  • identifying a friend via the enemy:
    friend = enemy.findNearest(friends) – it’s usually done the other way: enemy = friend.findNearestEnemy()
    BTW, why not use enemy.findNearestEnemy()?

Otherwise a very well done level, with useful new concepts! :smile: Like it! :+1:

1 Like

Don’t forget that might not to work in the real Python. Except for the object inherit Dict (or something similar).

1 Like

Can you post your full code? This sounds like an issue with Esper, so it’d be useful if we had more code.

1 Like

Excellent, thanks again Harry.

1 Like

can you help me with basic JS ?

                // Command the friend to build a firetrap
                // at the midpoint between them and enemy.

I don’t know how to do it.
In some cases you need add to x or y, in another to substract

So succeed I wrote a function


function midPosFromEnemy(war) {
    var poos = {};
    if (war.pos.x < 40) {
        poos.x = 23;
    } else {
        poos.x = 62;
    }
    if (war.pos.y < 36) {
        poos.y = 18;
    } else {
        poos.y = 56;
    }
    return poos;
}

it’s work but not caclulate middle position

1 Like

The middle point between two numbers is the two numbers added together divided by 2.

So: What is between 1 and 3? (1 + 3) / 2 = 2.

This same principle applies to 2-dimensions (and up)

What’s the point between (1, 4) and (2, 5)? ((1 + 2) / 2, (4 + 5) / 2) = (1.5, 4.5)

2 Likes

A very good level (teaching assigning properties to an object), not played more than a year, not visible on the mountain map, and surprise - not subscribers only!
Gain some reward

Thanks for finding that, I really enjoyed that level. And it’s shown me how to give something a .something property, which I’ve always wanted to do.

1 Like