Skip to content

Instantly share code, notes, and snippets.

@DaFrElUf
Last active January 17, 2022 16:25
Show Gist options
  • Save DaFrElUf/49ccfe86476aa6ac8267 to your computer and use it in GitHub Desktop.
Save DaFrElUf/49ccfe86476aa6ac8267 to your computer and use it in GitHub Desktop.
Solutions to the game "Untrusted" (http://alexnisnevich.github.io/untrusted/)
Level 1: Erase the two loops so there are no blocks
---
Level 2: Redefine the maze and add another exit
var maze = new ROT.Map.DividedMaze(1,1);
map.placeObject(map.getWidth()-6, map.getHeight()-5, 'exit');
---
Level 3: Place some walls so that there are minimum 104
for (x = 0; x <= map.getWidth(); x++) {
map.placeObject(x, 0, 'block');
map.placeObject(x, 1, 'block');
map.placeObject(x, 2, 'block');
}
---
Level 4: Add another exit
map.placeObject(map.getWidth() - 5, 20, 'exit');
---
Level 5: Color the mines
map.setSquareColor(x, y, '#00f');
---
Level 6: Place a block, go right until width - 3 and then down
map.placeObject(30,5,'block');
---
Level 7: Call everytime you don't get through the lock
var player = map.getPlayer();
if (player.getColor()=='#f00') {
player.setColor('#ff0');
}
else if (player.getColor()=='#ff0') {
player.setColor('#0f0');
}
else {
player.setColor('#f00');
}
---
Level 8: Phone to reload the Forrest
"generateForest"
---
Level 9: Invert the direction of the raft -> phone when you are on it
player.setPhoneCallback(function (){raftDirection='up';});
---
Level 10: Let the drones go away from there (attack/reinforcement/defense)
if (me.getY()==11)
me.move('left');
else
me.move('down');
me.move('down');
if (me.getY()==11)
me.move('right');
else
me.move('down');
---
Level 11: Let the robot walk
if (me.canMove('right'))
me.move('right');
else
me.move('down');
---
Level 12: Let the robot walk
if (me.getX()===1 && me.getY()<5)
me.move('down');
else {
if (me.getX()===20 && me.getY()>4)
me.move('up');
else {
if (me.canMove('right'))
me.move('right');
else
me.move('down');
}
}
---
Level 13: The robot walks to the x-position of the player, if he is on the position the robot walks down
var target = me.findNearest('player');
var leftDist = me.getX() - target.x;
var upDist = me.getY() - target.y;
var direction;
if (upDist == 0 && leftDist == 0)
return;
if (leftDist > 0)
direction = 'left';
else if (leftDist < 0)
direction = 'right';
else
direction = 'down';
if (me.canMove(direction))
me.move(direction);
else if (me.canMove('up'))
me.move('up');
---
Level 14: Go through the upper blue lock, then through the green and the left blue out. Go down and get the algorithm.
redKey');map.placeObject(24, 12, 'blueKey
---
Level 15: Make an error in the function so the player couldn't die
player.killedBy(you);
---
Level 16: Draw every line in its color and change yours by calling
ctx.strokeStyle = color;
player.setPhoneCallback(changeColor);
function changeColor() {
if (player.getColor()==='red')
player.setColor('teal');
else if (player.getColor()==='teal')
player.setColor('yellow');
else
player.setColor('red');
}
---
Level 17: Go only through portals (you may need some more attempts)
if (t1.getType() == 'teleporter' && t2.getType() == 'teleporter') {
var ctx = map.getCanvasContext();
ctx.beginPath();
ctx.strokeStyle = 'green';
ctx.lineWidth = 1;
ctx.moveTo(t1.getX()*13, t1.getY()*21);
ctx.lineTo(t2.getX()*13, t2.getY()*21);
ctx.stroke();
}
---
Level 18: Call the phone before you fall down ;)
var player = map.getPlayer();
map.placeObject(player.getX()+1, player.getY()+1, 'ladder');
}
map.defineObject('ladder',{
'type': 'static',
'symbol': '=',
'impassable': true,
'color': 'brown',});
function empty(){
---
Level 19: Just a small game..
Arrow-Up: Move to parent
Arrow-Down: Move to first child
Arrow-Left: Move to previous sibling
Arrow-Right: Move to next sibling
---
Level 20: Get the phone and then shoot the boss to hell
map.defineObject('wall',{
'type': 'static',
'symbol': '~',
'impassable': true,
'color': 'white',});
map.defineObject('gun',{
'type': 'static',
'symbol': '>',
'impassable': true,
'color': 'white',});
for (var x = 1; x < 49; x++){
map.placeObject(x, 9, 'wall');
}
for (var y = 5; y < 7; y++){
map.placeObject(0, y, 'gun');
}
map.defineObject('bullet2', {
'type': 'dynamic',
'symbol': '-',
'color': 'red',
'interval': 100,
'projectile': true,
'behavior': function (me) {me.move('right');}
});
function shoot() {
var player = map.getPlayer();
map.placeObject(1, 5, 'bullet2');
map.placeObject(1, 6, 'bullet2');
}
map.getPlayer().setPhoneCallback(shoot);
---
Level 21: Go to menu -> scripts -> object -> change 2 lines
if (!game.map.finalLevel) {
game._moveToNextLevel();
}}
to
//if (!game.map.finalLevel) {
game._moveToNextLevel();
//}}
Bonus
---
01_inTheDesert: You need to destroy the trap with the eye before you go to the exit
---
02_theEmptyRoom: Replace the 42 with...
{15:610,16:987,17:1597,18:2584,19:4181,20:6765,21:10946,22:17711,23:28657,24:46368,25:75025,26:121393,27:196418,28:317811,29:514229,30:832040,31:1346269,32:2178309,33:3524578,34:5702887,35:9227465,36:14930352,37:24157817,38:39088169,39:63245986,40:102334155,41:165580141,42:267914296,43:433494437,44:701408733,45:1134903170,46:1836311903,47:2971215073,48:4807526976,49:7778742049,50:12586269025,51:20365011074,52:32951280099,53:53316291173,54:86267571272,55:139583862445,56:225851433717,57:365435296162,58:591286729879,59:956722026041,60:1548008755920,61:2504730781961,62:4052739537881,63:6557470319842,64:0x9a661ca20bb,65:0xf9d297a859d,66:27777890035288,67:44945570212853,68:72723460248141,69:0x6b04f4c2fe42,70:0xad2934c6d08f,71:308061521170129,72:498454011879264,73:806515533049393,74:0x4a2dce62b0d91,75:0x780626e057bc2,76:0xc233f54308953,77:5527939700884757,78:8944394323791464,79:0x336a82d89c937c,80:0x533163ef0321e4,81:0x869be6c79fb560,82:0xd9cd4ab6a2d740,83:99194853094755490,84:0x23a367c34e563e0,85:0x39a9fadb327f080,86:0x5d4d629e80d5480,87:0x96f75d79b354500,88:0xf444c0183429980,89:0x18b3c1d91e77de00,90:0x27f80ddaa1ba7800,91:466004661037553e4,92:0x68a3dd8e61ecd000,93:0xa94fad42221f2800,94:0x111f38ad0840c0000,95:319404346349901e5,96:5168070885485833e4,97:8362114348984843e4,98:0x755b0bdd8fa998000,99:2189229958345552e5,100:3542248481792619e5}[input];
---
04_theGuard
map.placeObject(26, 12, 'block');
map.placeObject(28, 12, 'block');
map.placeObject(26, 13, 'block');
map.placeObject(27, 13, 'block');
map.placeObject(28, 13, 'block');
---
ANewJourney: Delete the impassible line of the tree in the source code
---
FrozenCave: Generate the level as often as you need! Go to the right side of the cave and then slide up to the block
map.placeObject(40, 6, 'block');
map.placeObject(47, 5, 'block');
---
BoulderMadness: green boulders are moveable, yellow ones are fixed and red ones kill you
@boulder
'color':'yellow',
@movingBoulder
'color':'green',
@trapBoulder
'color':'red',
---
BatAttack: Build up some walls...
---
PathOfDooM: Place walls
map.placeObject(map.getWidth()-4,8,'block');
map.placeObject(map.getWidth()-4,9,'block');
map.placeObject(map.getWidth()-4,10,'block');
map.placeObject(map.getWidth()-4,11,'block');
map.placeObject(map.getWidth()-4,12,'block');
---
Ice: Let the player move while he is on ice
map.startTimer(function() {
map.overrideKey('up', null);
map.overrideKey('down', null);
map.overrideKey('left', null);
map.overrideKey('right', null);
},200);
---
levelName: After you pass the star you are able to change your color when you press 'right'
map.defineObject('star',
{
'symbol': '*',
'color': '#ff0',
'onCollision': function()
{
map.overrideKey('right', function()
{
var player = map.getPlayer();
player.setColor('#0f0');
});
}
});
map.placeObject(30,9,'star');
---
pushme:Destroy the drones with bullets
in the gap:
'onCollision':function(){map.placeObject(23,12,'bullet2');},
in the source code of object (after exit for example):
'bullet2' : {
'type': 'dynamic',
'symbol': '-',
'color': 'red',
'interval': 100,
'projectile': true,
'behavior': function (me) {me.move('right');}
},
---
threekeys
---
trapped: set the destination for the teleporters
teleport1.setTarget(teleport2);
teleport2.setTarget(teleport1);
---
wallswitheyes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment