-
Notifications
You must be signed in to change notification settings - Fork 1
/
portal.js
113 lines (105 loc) · 2.85 KB
/
portal.js
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
/*
*** PORTAL JS ***
*/
/*
"https://aframe.io/a-blast"
"https://ybinstock.github.io/BatCave"
"https://ybinstock.github.io/Platos-Cave"
"http://ybinstock.github.io/carmensandiego_360", "assets/sounds/carmen_audio_ending.mp3"
"https://ybinstock.github.io/starstuff"
"https://aurora.jam3.net/#!"
*/
var top_portal,
right_portal,
bottom_portal,
left_portal,
top_reset = false,
right_reset = false,
bottom_reset = false,
left_reset = false;
function portalUpdate() {
var portal = {
"fire_temple" : {
"link": "https://sjcobb.github.io/fire-temple",
"song": "assets/sounds/fire-temple.mp3",
"volume": 100
},
"ice_cavern" : {
"link": "https://sjcobb.github.io/ice-cavern",
"song": "assets/sounds/ice-cavern.mp3",
"volume": 70
},
"lake_hylia" : {
"link": "https://sjcobb.github.io/lake-hylia",
"song": "assets/sounds/lake-hylia.mp3",
"volume": 60
},
"bat_cave" : {
"link": "https://ybinstock.github.io/BatCave",
"song": "assets/sounds/bats.mp3",
"volume": 20
},
/*"a_blast" : {
"link": "https://aframe.io/a-blast",
"song": "assets/sounds/ablast.ogg",
"volume": 20
},*/
"aurora" : {
"link": "https://aurora.jam3.net/#!/",
"song": "assets/sounds/aurora.mp3",
"volume": 40
},
"plato" : {
"link": "https://ybinstock.github.io/Platos-Cave",
"song": "assets/sounds/plato-script.mp3",
"volume": 50
},
"outsidelands" : {
"link": "https://ngokevin.github.io/aframe-magicavoxel-projects/outsidelands",
"song": "assets/sounds/outsidelands.mp3",
"volume": 50
}
};
var lost_reset = {
"song": "assets/sounds/lost-woods.mp3",
"volume": 120
};
var randomProperty = function (obj) {
var keys = Object.keys(obj);
var rdm_key = keys.length * Math.random() << 0;
var rdm_portal = obj[keys[rdm_key]];
delete obj[keys[rdm_key]];
return rdm_portal;
};
top_portal = randomProperty(portal);
right_portal = randomProperty(portal);
bottom_portal = randomProperty(portal);
left_portal = randomProperty(portal);
var reset_portal = Math.floor(Math.random()*4);
switch (reset_portal) {
case 0:
top_portal = lost_reset;
top_reset = true;
break;
case 1:
right_portal = lost_reset;
right_reset = true;
break;
case 2:
bottom_portal = lost_reset;
bottom_reset = true;
break;
case 3:
left_portal = lost_reset;
left_reset = true;
break;
}
console.log("top: ");
console.log(top_portal);
console.log("right: ");
console.log(right_portal);
console.log("bottom: ");
console.log(bottom_portal);
console.log("left: ");
console.log(left_portal);
}