Live data from Hacker News

Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

alex.nisnevich.com

201–210 of 246 posts

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#203

Anybody think of another way to do the robot levels without adding any state? https://gist.github.com/db41e069df7bae142248

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

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

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#204

Earlier quoted context omitted.

For the truly lazy, this was my approach: map.overrideKey('up', function() { if (map.countObjects('boss') > 0) { for (var x = 0; x

Nice. Lacks drama though, where's the dash through the rain of bullets to recover the missile launcher? :D

I monkey-patched Math.random() to launch horizontal missiles at the top of the screen and always return 1.

:-)

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#205

Earlier quoted context omitted.

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.

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#206
post #153
post #152

Earlier quoted context omitted.

Ah, yes. That's very convenient. I don't see anywhere to edit on level 21, and level select says there's one more...

Hmm, do you notice anything different about the menu now that you're on level 21?

Wow, great. I had noticed but didn't think you could do that!!

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#207
post #179

I actually used a "private API" in level 14, crisps contest. https://gist.github.com/anonymous/dacd3f1de73a59b5983e Is this cheating?

I completely cheated (added an extra key by setting a trace in the console) because I looked for an editable line for about 10 minutes and couldn't find it. Solved it now by changing greenKey to theAlgorithm

Could you explain how you would do this? There doesn't seem to be an editable line, what's the trick?

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#209
post #15

> "If you can read this, you are cheating! D:" Loaded the site, popped open the Chrome Dev Tools, and was thoroughly disappointed.

Why were you disappointed?

Well, the title says you play the game by modifying the game's source. Turns out you don't modify the game's source, you modify specific snippets of code that are provided on the page.

Last weekend I hacked around in the source of various online games, I anticipated this to be a similar experience but was disappointed to find that we weren't supposed to actually change the game's source.

Re: Show HN: Untrusted, a JavaScript adventure game you play by modifying its source

#210

Any tips on level 15? Once the player is killed what could I possibly do?

I actually figured something out with this which is weird, because I don't think it has to do with exceptions. I passed in a new object of an undeclared type and just walked across the water, which I can't explain. Can anyone help?

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

Post reply on HN