Play Home Contribute GitHub Join Us Discourse Staff Members GitHub Contribution Guides Team

[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.


I like how you made the map.

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


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

completed without issue in Javascript mode

added LUA patch


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:


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


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


Excellent, thanks again Harry.


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


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)