-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter9
More file actions
61 lines (46 loc) · 1.46 KB
/
Copy pathchapter9
File metadata and controls
61 lines (46 loc) · 1.46 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function startLevel(map) {
var raftDirection = 'down';
map.placePlayer(map.getWidth()-1, map.getHeight()-1);
map.defineObject('raft', {
'type': 'dynamic',
'symbol': '▓',
'color': '#420',
'transport': true, // (prevents player from drowning in water)
'behavior': function (me) {
me.move(raftDirection);
}
});
map.defineObject('water', {
'symbol': '░',
'color': '#44f',
'onCollision': function (player) {
player.killedBy('drowning in deep dark water');
}
});
for (var x = 0; x < map.getWidth(); x++) {
for (var y = 5; y < 15; y++) {
map.placeObject(x, y, 'water');
}
}
map.placeObject(20, 5, 'raft');
map.placeObject(0, 2, 'exit');
map.placeObject(0, 1, 'block');
map.placeObject(1, 1, 'block');
map.placeObject(0, 3, 'block');
map.placeObject(1, 3, 'block');
<SOLUTION>
var functionList = {};
functionList['WAZAAA'] = function(){
raftDirection ='up';
}
map.getPlayer().setPhoneCallback(functionList["WAZAAA"]);
// Stop calling Mr president , plz.
<SOLUTION>
<OTHER SOLUTION I WONT SHOW (try yourself :)>
you can make a "bridge" with some "raft". there is a limite of raft number, but none about yacht :)
<OTHER SOLUTION>
}
function validateLevel(map) {
map.validateExactlyXManyObjects(1, 'exit');
map.validateExactlyXManyObjects(1, 'raft');
}