Lurker News

Comments (235) 72 threads

Show all comments

Showing thread 22 of 72

opnitro#
Yeah, I just built a wall that it got stuck behind, then I could run to the door before it got me. Don't have the code sorry.
columbo#
I _was_ going to build a pathfinder since it's a well documented process, but it was more work than just making the player a joystick

http://qiao.github.io/PathFinding.js/visual/
You'd just need to recalc the pathfinder each time.

xmonkee#
https://gist.github.com/xmonkee/10099892

The robot follows my player, unless it's green, in which case it goes 'down' (cause it wont pick up the key under remote control for some reason). I'm saving state in the color of the player.

christiangenco#
This was mine:

    var r = Math.random();
    me.move(
      r < 0.4 ? 'right' :
        r<0.6 ? 'up' :
          r < 0.8 ? 'down' :
            'left'
    );
Works eventually :)

For level 13 I just used:

    me.move(Math.random() > 0.5 ? 'right' : 'down');
And regenerated the map until I got to one that could be solved by moving only right and down.