-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
487 lines (440 loc) · 17.8 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Solar Cycle</title>
<meta name="description" content="The mini roguelike for your desk." />
<!-- Basic Open Graph -->
<meta content="Solar Cycle" itemProp="name" class="next-head" />
<meta content="The mini roguelike for your desk." itemProp="description" class="next-head" />
<!-- Facebook Meta Tags -->
<meta property="og:site_name" content="Solar Cycle">
<meta property="og:url" content="https://solgarden.onrender.com/">
<meta property="og:type" content="website">
<meta property="og:title" content="Solar Cycle">
<meta property="og:description" content="The mini roguelike for your desk.">
<meta property="og:image" content="https://solgarden.onrender.com/opengraph.jpg">
<!-- Twitter Meta Tags -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:domain" content="lobau.io">
<meta name="twitter:url" content="https://solgarden.onrender.com/">
<meta name="twitter:title" content="Solar Cycle">
<meta name="twitter:description" content="The mini roguelike for your desk.">
<meta name="twitter:image" content="https://solgarden.onrender.com/opengraph.jpg">
<script src="mrjs-build/mr.js"></script>
<link rel="preload" href="/assets/fonts/JetBrainsMono-Medium.ttf" as="font" type="font/truetype" crossorigin />
<style>
@font-face {
font-family: 'JetBrains';
src: url('/assets/fonts/JetBrainsMono-Medium.ttf') format('truetype');
font-weight: 400;
font-style: normal;
}
:root {
--scale: 0.08;
}
html,
body {
background-color: #0a0a0a;
font-family: 'JetBrains';
overflow: hidden;
}
.end-turn {
color: white;
font-size: 120px;
line-height: 80px;
border-radius: 50px;
padding: 150px;
}
.text-label {
font-size: 10px;
}
.label-container {
display: flex;
flex-direction: row;
gap: 20px;
}
#start-wall {
pointer-events: none;
scale: var(--scale);
}
#ui {
scale: var(--scale);
}
.hud-text {
color: #ffffff;
font-size: calc(13px / var(--scale));
}
#hp-label,
#range-label,
#action-label {
width: calc(400px / var(--scale));
height: calc(200px / var(--scale));
}
.wall-text {
color: #fff;
font-size: calc(9px / var(--scale));
width: calc(2000px / var(--scale));
}
.progress-bar {
scale: 0.75;
}
#end-turn-button {
font-size: calc(15px / var(--scale));
width: calc(800px / var(--scale));
height: calc(800px / var(--scale));
border-radius: calc(3px / var(--scale));
padding: calc(30px / var(--scale));
}
</style>
</head>
<body>
<!-- <mr-app data-orbital="mode:true" data-stats="true" data-debug='false'> -->
<!-- <mr-app data-orbital="mode:true" data-camera="mode:orthographic; startPos:0 2 3;"> -->
<mr-app data-orbital="mode:true; targetPos:0 0 0;" data-camera="mode: orthographic; startPos:0 0 0;">
<mr-light color="#fff4b8" intensity="0.8" data-position="-0.25 1 -0.25"></mr-light>
<mr-light color="#a4f1ff" intensity="0.5" data-position="0.5 0.1 0.5"></mr-light>
<mr-entity class='game' data-comp-game="autoEndTurn: false; tableOffset: 0.05" data-comp-anchor="type: plane; label: table">
<mr-damage-tile id="damage-tile"></mr-damage-tile>
<!-- The wall behind the first room -->
<mr-div id='start-wall' data-rotation='0 270 0'>
<mr-model class="solgarden" src='./assets/ui-models/logoWall1.glb'></mr-model>
<mr-div data-position='0 2.35 0'>
<mr-text id='disposed-robots' class='wall-text' data-position='-0.55 -0.4 0'>loading</mr-text>
<mr-text id='farthest-room' class='wall-text' data-position='-0.55 -0.55 0'>loading</mr-text>
</mr-div>
</mr-div>
<!-- The floating UI in front of the board -->
<mr-div id='ui' data-rotation='270 -30 270'>
<!-- The HP bar and label -->
<mr-div data-position='0 0.3 0'>
<mr-text id='hp-label' class='hud-text' data-position='-0.25 0 0'>99</mr-text>
<mr-model id="hp-progress" class="progress-bar" src='./assets/ui-models/UI_bar1-red.glb' data-rotation='90 0 0'></mr-model>
</mr-div>
<!-- The range bar and label -->
<mr-div data-position='0 0 0'>
<mr-text id='range-label' class='hud-text' data-position='-0.25 0 0'>99</mr-text>
<mr-model id="range-progress" class="progress-bar" src='./assets/ui-models/UI_bar1-green.glb' data-rotation='90 0 0'></mr-model>
</mr-div>
<!-- The action balls -->
<mr-div data-position='0 -0.3 0'>
<mr-text id='action-label' class='hud-text' data-position='-0.25 0 0'>99</mr-text>
<mr-ui-actions id="ui-actions"></mr-ui-actions>
</mr-div>
<mr-button id='end-turn-button' data-position='2.6 0 0'>End turn</mr-button>
<mr-ui-weapon id='ui-melee' data-type='0' data-rotation='270 180 180' data-position='-2.5 0 0.1'></mr-ui-weapon>
<mr-ui-weapon id='ui-range' data-type='1' data-rotation='270 180 180' data-position='-1.5 0 0.1'></mr-ui-weapon>
</mr-div>
<mr-entity id="chess-sound" data-comp-audio="src: ./assets/audio/chess.mp3; loop: false; state: stop;"></mr-entity>
<!-- <mr-entity id="door-sound" data-comp-audio="src: ./assets/audio/door-hinge.mp3; loop: false; state: stop;"></mr-entity> -->
<mr-entity id="analog-sound" data-comp-audio="src: ./assets/audio/analog.mp3; loop: false; state: stop;"></mr-entity>
<mr-entity id="clash-sound" data-comp-audio="src: ./assets/audio/clash.mp3; loop: false; state: stop;"></mr-entity>
<mr-entity id="nope-sound" data-comp-audio="src: ./assets/audio/nope.mp3; loop: false; state: stop;"></mr-entity>
<mr-entity id="swoosh-sound" data-comp-audio="src: ./assets/audio/swoosh.mp3; loop: false; state: stop;"></mr-entity>
<mr-entity id="latch-sound" data-comp-audio="src: ./assets/audio/latch.mp3; loop: false; state: stop;"></mr-entity>
<mr-entity id="spawn-sound" data-comp-audio="src: ./assets/audio/immersion-cut.mp3; loop: true; state: stop;"></mr-entity>
<mr-entity id="fridge-sound" data-comp-audio="src: ./assets/audio/fridge.mp3; loop: true; state: stop;"></mr-entity>
<mr-entity id="plains-sound" data-comp-audio="src: ./assets/audio/farm.mp3; loop: true; state: stop;"></mr-entity>
<mr-entity id="desert-sound" data-comp-audio="src: ./assets/audio/badlands.mp3; loop: true; state: stop;"></mr-entity>
<mr-entity id="night-forest" data-comp-audio="src: ./assets/audio/night-forest.mp3; loop: true; state: stop;"></mr-entity>
</mr-entity>
</mr-app>
<script>
const DEFAULT_STATE = {
isDebug: false,
isPlayerTurn: true,
isInteractive: true,
staticUntil: 0,
hasKey: false,
level: 0,
health: 20,
range: 15,
action: 4,
projectedCost: 0,
displayRange: 0,
ppos: {
x: 1,
y: 1
},
dpos: {
x: 0,
y: 5,
},
weapons: [{
subtype: '',
attack: 0,
range: 0,
crits: 0,
cost: 0
},
{
subtype: '',
attack: 0,
range: 0,
crits: 0,
cost: 0,
ammoType: 'stone',
}
],
selectedWeaponID: 0,
}
const STATE = structuredClone(DEFAULT_STATE);
const COLORS = {
movement: "#00ffff",
objects: "#ff7a00",
neutral: "#888",
hover: "#875dff",
health: "#e72d75",
range: "#00e82c",
enemies: "#ff0000",
debug: '#00ff00',
white: '#ffffff'
}
const ENEMY_SUBTYPES = [
'static',
'homing',
'aimless',
];
const ENEMY_MODELS = {
static: "assets/models/enemy-shooter1.glb",
homing: "assets/models/enemy-floater1.glb",
aimless: "assets/models/enemy-hopper1.glb",
}
const WEAPONS = [
[{
subtype: 'twig',
gameModel: "assets/models/weapon-stick1-pickup.glb",
uiModel: "assets/models/weapon-stick1-UI.glb",
ammoType: '',
range: 1,
crits: 0,
cost: 1,
},
{
subtype: 'shortsword',
gameModel: "assets/models/weapon-shortSword1-pickup.glb",
uiModel: "assets/models/weapon-shortSword1-UI.glb",
ammoType: '',
range: 1.5,
crits: 0.1,
cost: 1,
},
],
[{
subtype: 'slingshot',
gameModel: "assets/models/weapon-slingshot1-pickup.glb",
uiModel: "assets/models/weapon-slingshot1-UI.glb",
ammoType: 'stone',
range: 2,
crits: 0.1,
cost: 3,
},
{
subtype: 'bow',
gameModel: "assets/models/weapon-bow1-pickup.glb",
uiModel: "assets/models/weapon-bow1-UI.glb",
ammoType: 'arrow',
range: 3,
crits: 0.2,
cost: 3,
},
]
]
const generateSpawnRoomParams = () => {
return {
floorCount: 1,
rowCount: 6,
colCount: 4,
enemyCount: 0,
propCount: 0,
blockCount: 0,
isChest: false,
biome: {
name: 'spawn',
path: "assets/biomes/spawn/",
audio: "",
tiles: ["tilegrass001.glb", "tilegrass002.glb", "tilegrass003.glb"],
props: [],
block: ["rock001.glb"],
},
entityMap: [
[0, 0, {
el: document.createElement("mr-spawn-i"),
type: 'prop'
}, 0],
[0, 0, 0, 0],
[{
el: document.createElement("mr-spawn-rock"),
type: 'prop'
}, 0, 0, 0],
[0, 0, {
el: document.createElement("mr-spawn-ii"),
type: 'prop'
}, {
el: document.createElement("mr-entity"),
type: 'prop'
}],
[0, 0, {
el: document.createElement("mr-entity"),
type: 'prop'
}, {
el: document.createElement("mr-entity"),
type: 'prop'
}],
[0, 0, {
el: document.createElement("mr-entity"),
type: 'prop'
}, {
el: document.createElement("mr-entity"),
type: 'prop'
}],
],
propMap: [
[0, 0, 0, 0],
[0, {
el: document.createElement("mr-battery-iii"),
type: 'battery'
}, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
],
lootMap: [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, {
el: document.createElement("mr-weapon"),
type: 'weapon',
weaponID: 0,
subtype: 'twig',
attack: 1,
range: WEAPONS[0][0].range,
crits: WEAPONS[0][0].crits,
ammoType: WEAPONS[0][0].ammoType,
cost: WEAPONS[0][0].cost,
}, 0, 0],
[0, 0, 0, 0],
[0, {
el: document.createElement("mr-key"),
type: 'key'
}, 0, 0],
]
}
}
const generateBatteryRoomParams = () => {
return {
floorCount: 1,
rowCount: 8,
colCount: 4,
enemyCount: 0,
propCount: 12,
blockCount: 0,
isChest: false,
isLore: false,
biome: {
name: 'battery',
path: "assets/biomes/battery-room/",
audio: "/assets/audio/fridge.mp3",
tiles: ["tilegrass001.glb"],
props: ["plant_01.glb",
"plant_02.glb",
"plant_03.glb",
"plant_04.glb",
"plant_05.glb"
],
block: []
},
entityMap: [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, {
el: document.createElement("mr-battery-ii"),
type: 'prop'
}, {
el: document.createElement("mr-battery-i"),
type: 'prop'
}, 0],
[0, 0, {
el: document.createElement("mr-battery-iv"),
type: 'prop'
}, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
],
propMap: [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, {
el: document.createElement("mr-battery-iii"),
type: 'battery'
}, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
]
}
}
const BIOMES = [{
// plains
name: "plains",
path: "assets/biomes/plains/",
tiles: ["tilegrass001.glb", "tilegrass002.glb", "tilegrass003.glb"],
props: ["plant_01.glb", "plant_02.glb", "plant_03.glb", "plant_04.glb", "plant_05.glb"],
block: ["rock001.glb"]
},
{
// desert
name: "desert",
path: "assets/biomes/deserts/",
tiles: ["tiledesert001.glb", "tiledesert002.glb", "tiledesert003.glb"],
props: ["plant_05.glb", 'plant_08-cactus1.glb'],
block: ["rockdesert001.glb", "rockdesert002.glb"]
},
{
// forest
name: "forest",
path: "assets/biomes/forest/",
tiles: ["tileforest001.glb"],
props: ["plant_06-fern1.glb", "plant_07-mushrooms1.glb"],
block: ["pine1.glb", "rockforest001.glb", "stump1.glb"]
}
]
</script>
<!-- Utils -->
<!--
Note: We place this first so that other scripts can share the
functions it contains since JavaScript executes sequentially.
-->
<script src="/js/utils.js"></script>
<!-- Classes -->
<script src="/js/sound-controller.js"></script>
<script src="/js/pathfinder.js"></script>
<script src="/js/board.js"></script>
<!-- MRjs Systems -->
<script src="/js/systems/mr-game.js"></script>
<!-- Mrjs Entities -->
<script src="/js/entities/mr-battery.js"></script>
<script src="/js/entities/mr-spawn.js"></script>
<script src="/js/entities/mr-chest.js"></script>
<script src="/js/entities/mr-door.js"></script>
<script src="/js/entities/mr-enemy.js"></script>
<script src="/js/entities/mr-goal.js"></script>
<script src="/js/entities/mr-key.js"></script>
<script src="/js/entities/mr-loot.js"></script>
<script src="/js/entities/mr-lore.js"></script>
<script src="/js/entities/mr-player.js"></script>
<script src="/js/entities/mr-projectile.js"></script>
<script src="/js/entities/mr-prop.js"></script>
<script src="/js/entities/mr-tile.js"></script>
<script src="/js/entities/mr-weapon.js"></script>
<script src="/js/entities/mr-damage-tile.js"></script>
<script src="/js/entities/mr-ui-weapon.js"></script>
<script src="/js/entities/mr-ui-actions.js"></script>
</body>
</html>