/
index.html
144 lines (114 loc) · 5.32 KB
/
index.html
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="css/html_style.css" />
<!-- link: https://clocks-in-a-cooler.github.io/map_adventure/ -->
</head>
<body>
<!-- scripts, in alphabetical order -->
<script src="javascript/cabinet.js"></script>
<script src="javascript/character.js"></script>
<script src="javascript/engine.js"></script>
<script src="javascript/event_handler.js"></script>
<script src="javascript/generate_map.js"></script>
<script src="javascript/game_state.js"></script>
<script src="javascript/inventory_panel_manager.js"></script>
<script src="javascript/map.js"></script>
<script src="javascript/map_panel_manager.js"></script>
<script src="javascript/map_tiles.js"></script>
<script src="javascript/scene_handler.js"></script>
<!-- content, in alphabetical order -->
<script src="game_content/prison_mine_ore.js"></script>
<script src="game_content/scene_template.js"></script>
<div id=game>
<div id="messages">
</div>
<div id="inventory">
<!-- this div is for displaying the inventory
individual items will be displayed each as a <div class="inventory_item"
this will probably be handled by a seperate module. (fun!) -->
</div>
<div id="map_panel">
<button onclick="button_click();">something will happen</button>
</div>
</div>
<div id="links">
<a target="_blank" href="https://www.github.com/clocks-in-a-cooler/map_adventure">github</a>
<br />
<a target="_blank" href="http://adarkroom.doublespeakgames.com/">inspired by...</a>
</div>
<script>
/* references of different parts of the page, for the engine */
var game_panel = document.getElementById("game");
var inventory_panel = document.getElementById("inventory");
var message_panel = document.getElementById("messages");
var map_panel = document.getElementById("map_panel");
EH.init();
function random_number(start, end) {
var multiplier = Math.abs((start - end));
var adder = Math.min(start, end);
return Math.floor(Math.random() * multiplier + adder);
}
function create_element(tag, attributes) {
var element = document.createElement(tag);
var att;
while (attributes.length > 0) {
var att_obj = attributes.shift();
att = document.createAttribute(att_obj.name);
att.value = att_obj.value;
element.setAttributeNode(att);
}
return element;
}
function deep_copy(obj) {
var properties = Object.getOwnPropertyNames(obj);
var new_obj = {};
while (properties.length > 0) {
if (typeof obj[properties[0]] == "object") {
new_obj[properties[0]] = deep_copy(obj[properties[0]]);
} else {
new_obj[properties[0]] = obj[properties[0]];
}
properties.shift();
}
return new_obj;
}
Object.prototype.deep_equal = function(that) {
if (typeof that != "object") {
//fail safe, because idiots exist
return false;
}
var properties = Object.getOwnPropertyNames(this);
var equal = true;
while (properties.length > 0 && equal == true) {
if (typeof this[properties[0]] == "object") {
equal = (this[properties[0]].deep_equal(that[properties[0]]));
} else {
equal = (this[properties[0]] == that[properties[0]]);
}
properties.shift();
}
return equal;
};
Array.prototype.deep_equal = function(that) {
if (!Array.isArray(that)) {
return false;
}
for (var i = 0; i < Math.max(this.length, that.length); i++) {
if (this[i] !== that[i]) {
return false;
}
}
return true;
};
function button_click() {
Engine.notify("something has happened.");
GSM.start_game();
//MPM.display_map(generate_prison_mine_map(70, 70));
}
Engine.notify("Alternatively, click the button.");
Engine.notify("Use the developer console (CTRL + SHIFT + I) or Firefox's Scratchpad to interact with and test the scripts.")
</script>
</body>
</html>