For the best experience on desktop, install the Chrome extension to track your reading on news.ycombinator.com
Hacker Newsnew | past | comments | ask | show | jobs | submit | history | SheeEttin's commentsregister

Well you can play it that way too, if you want. Try overriding some of the internal functions using creative methods. :)


We've also been discussing it over on reddit: http://www.reddit.com/r/webdev/comments/22gxx1/untrusted_a_j...


Ooh, shift, nice. Didn't know about that. That should come in handy.


I'm trying with

    player.killedBy(function(){throw new Exception();});
...but then that just means I get killed by "function(){throw new Exception();}".

Edit: never mind, got it. Overriding onCollision helps. :)

https://gist.github.com/anonymous/2868beb0cee19259ebb5


https://gist.github.com/anonymous/12b15e3de9340655ed78

Variable to control the direction the robot moves, changed with the function phone.


A good solution would be to remove an invalid item, and the function should silently try to remove the invalid item, but still allow passage. For some reason, even when you have the green key, but try to remove an invalid item, it still doesn't let you through, despite apparently returning false (passable).

Additionally it doesn't support injection there, so while "player.removeItem('greenKey'); player.additem('greenKey');" should work, it says "TypeError: undefined is not a function".


I approached it like this:

player.removeItem('greenKey'); return 0;} if(1==1){('');

Full link: https://gist.github.com/anonymous/c78b439d8f2369e03f68

Basically, this let's you delete the green item once. After that, it makes sure that return true is never reached (because of the 1==1), so next passages through green are allowed. Kinda liked the sneaky (''); myself :P


I thought https://gist.github.com/anonymous/cfe03f2ddb0052b38081 was kind of neat, as you still have to solve the puzzle a bit after using it.


Of course. I made them harmless and walked right through them.


Tried that, but for some reason I couldn't disable the onCollision by assigning it to some dummy function. Do you mind sharing your solution?


I wish we could retrieve the solution we used for past levels. :(

Okay, I think I've replicated it. I just overrode onCollision with empty braces, so the final definition looked like this:

    map.defineObject('attackDrone', {
        'type': 'dynamic',
        'symbol': 'd',
        'color': 'red',
        'onCollision': function (player) {
            player.killedBy('an attack drone');
        },
        'behavior': function (me) {
        },
        'onCollision': function (player) {
        }
    });
Note that you're closing the game's braces, inserting another definition, then re-opening braces to match the game's closing ones.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search:

HN For You