Back to front pageView on Hacker News (opens in a new tab)Show HN: Untrusted, a JavaScript adventure game you play by modifying its source (opens in a new tab)alex.nisnevich.com555 pointsby alnis (on Hacker News)12 years agoComments (235) 72 threadsShow all commentsShowing thread 7 of 72[-]th0br012 years ago2 replies#You should reinit the map though, otherwise doing this on level 2 causes funny bugs (and makes the game rather easy ;) maze.create = function() {}; var tmp = map.placeObject; map.placeObject = function(x, y, t) { if(t == 'exit') tmp(x,y,t); };[-]untitaker_12 years ago4 replies#level 2 can be solved by using the two "unlocked" lines to comment out the whole maze.create call, too.matsemann12 years ago#That's kinda the point, though. Read the comments for that file. ;)mt3ck12 years ago#thanks for the help ;)randunel12 years ago#you don't need 2 lines, you only need the one below to overwrite the map function, and leave an open dot :Dmap.placeObject(7,4,'exit');var a = {map: {placeObject:function(){}}};a.zenojevski12 years ago#Related: things like these do not work, because of implementation. if (false) // <- inserted by me for (var ...) { // <- existing code ...code... } Too bad, because extra `for`s could be fun...alnis12 years ago#If you reload the game, the map should now re-init on every level.PS. I'm really enjoying all the creative solutions you guys are coming up with!
Show HN: Untrusted, a JavaScript adventure game you play by modifying its source (opens in a new tab)alex.nisnevich.com555 pointsby alnis (on Hacker News)12 years ago
th0br012 years ago2 replies#You should reinit the map though, otherwise doing this on level 2 causes funny bugs (and makes the game rather easy ;) maze.create = function() {}; var tmp = map.placeObject; map.placeObject = function(x, y, t) { if(t == 'exit') tmp(x,y,t); };
untitaker_12 years ago4 replies#level 2 can be solved by using the two "unlocked" lines to comment out the whole maze.create call, too.
randunel12 years ago#you don't need 2 lines, you only need the one below to overwrite the map function, and leave an open dot :Dmap.placeObject(7,4,'exit');var a = {map: {placeObject:function(){}}};a.
zenojevski12 years ago#Related: things like these do not work, because of implementation. if (false) // <- inserted by me for (var ...) { // <- existing code ...code... } Too bad, because extra `for`s could be fun...
alnis12 years ago#If you reload the game, the map should now re-init on every level.PS. I'm really enjoying all the creative solutions you guys are coming up with!
Comments (235) 72 threads
Show all comments
Showing thread 7 of 72
map.placeObject(7,4,'exit');var a = {map: {placeObject:function(){}}};a.
PS. I'm really enjoying all the creative solutions you guys are coming up with!