-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter2
More file actions
35 lines (25 loc) · 1.01 KB
/
Copy pathchapter2
File metadata and controls
35 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function startLevel(map) {
map.placePlayer(7, 5);
var maze = new ROT.Map.DividedMaze(map.getWidth(), map.getHeight());
maze.create( function (x, y, mapValue) {
// don't write maze over player
if (map.getPlayer().atLocation(x,y)) {
return 0;
}
else if (mapValue === 1) { //0 is empty space 1 is wall
map.placeObject(x,y, 'block');
}
else {
map.placeObject(x,y,'empty');
}
});
map.placeObject(map.getWidth()-4, map.getHeight()-4, 'block');
map.placeObject(map.getWidth()-6, map.getHeight()-4, 'block');
map.placeObject(map.getWidth()-5, map.getHeight()-5, 'block');
map.placeObject(map.getWidth()-5, map.getHeight()-3, 'block');
<SOLUTION>
map.placeObject(7,5,'exit'); // mhhh, easy , i will overwrite myself as an exit :)
//obiously, it don't, but now just move, you were hiding an exit O.o ....
<SOLUTION>
map.placeObject(map.getWidth()-5, map.getHeight()-4, 'exit');
}