hytopia 0.3.32 → 0.3.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -100,6 +100,21 @@
100
100
  const clone = template.content.cloneNode(true);
101
101
  return clone;
102
102
  });
103
+
104
+ // MOBILE CONTROLS
105
+ // Handle jump button touch / untouch
106
+ const mobileJumpButton = document.getElementById('mobile-jump-button');
107
+ mobileJumpButton.addEventListener('touchstart', e => {
108
+ e.preventDefault();
109
+ mobileJumpButton.classList.add('active');
110
+ hytopia.pressInput(' ', true);
111
+ });
112
+
113
+ mobileJumpButton.addEventListener('touchend', e => {
114
+ e.preventDefault();
115
+ mobileJumpButton.classList.remove('active');
116
+ hytopia.pressInput(' ', false);
117
+ });
103
118
  </script>
104
119
 
105
120
  <!-- Game Start Countdown -->
@@ -119,6 +134,13 @@
119
134
  </div>
120
135
  </div>
121
136
 
137
+ <!-- MOBILE CONTROLS -->
138
+ <div class="mobile-controls">
139
+ <a id="mobile-jump-button" class="mobile-button">
140
+ <img src="{{CDN_ASSETS_URL}}/icons/jump.png" />
141
+ </a>
142
+ </div>
143
+
122
144
  <!-- Template for Join NPC Scene UI-->
123
145
  <template id="join-npc-message">
124
146
  <div class="join-npc-message">
@@ -246,4 +268,51 @@
246
268
  .time {
247
269
  color: #ffd700;
248
270
  }
271
+
272
+ /* By default, we hide the mobile controls */
273
+ .mobile-controls {
274
+ display: none;
275
+ }
276
+
277
+ /*
278
+ We can use the body.mobile class to detect if we're on a mobile device.
279
+ The HYTOPIA game client will always add this class to the body element when running on a mobile device.
280
+ */
281
+ body.mobile .mobile-controls { /* If this css selector matches because we're on mobile, show the mobile controls */
282
+ display: flex;
283
+ gap: 14px;
284
+ position: fixed;
285
+ bottom: 40px;
286
+ right: 40px;
287
+ }
288
+
289
+ /* You can configure and style your buttons however you'd like. This is a minimalistic starting point. */
290
+ .mobile-button {
291
+ background-color: rgba(0, 0, 0, 0.5);
292
+ border-radius: 50%;
293
+ align-items: center;
294
+ justify-content: center;
295
+ display: flex;
296
+ width: 50px;
297
+ height: 50px;
298
+ transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
299
+ will-change: transform, background-color;
300
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
301
+ font-family: 'Inter', sans-serif;
302
+ font-size: 14px;
303
+ font-weight: bold;
304
+ color: rgba(255, 255, 255, 0.8);
305
+ text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
306
+ }
307
+
308
+ .mobile-button img {
309
+ width: 22px;
310
+ height: 22px;
311
+ }
312
+
313
+ .mobile-button.active {
314
+ transform: scale(0.92);
315
+ background-color: rgba(0, 0, 0, 0.75);
316
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
317
+ }
249
318
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.3.32",
3
+ "version": "0.3.34",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -1,356 +0,0 @@
1
- {
2
- "asset": {
3
- "generator": "glTF-Transform v4.1.1",
4
- "version": "2.0"
5
- },
6
- "accessors": [
7
- {
8
- "type": "SCALAR",
9
- "componentType": 5123,
10
- "count": 36,
11
- "bufferView": 0,
12
- "byteOffset": 0
13
- },
14
- {
15
- "type": "VEC3",
16
- "componentType": 5126,
17
- "count": 24,
18
- "max": [
19
- 0.140625,
20
- 1.7109375,
21
- 0.03125
22
- ],
23
- "min": [
24
- -0.171875,
25
- 0.5234375,
26
- -0.09375
27
- ],
28
- "bufferView": 1,
29
- "byteOffset": 0
30
- },
31
- {
32
- "type": "VEC3",
33
- "componentType": 5126,
34
- "count": 24,
35
- "bufferView": 1,
36
- "byteOffset": 12
37
- },
38
- {
39
- "type": "VEC2",
40
- "componentType": 5126,
41
- "count": 24,
42
- "bufferView": 1,
43
- "byteOffset": 24
44
- },
45
- {
46
- "type": "VEC3",
47
- "componentType": 5126,
48
- "count": 24,
49
- "max": [
50
- 0.0625,
51
- 1.0625,
52
- 0.0625
53
- ],
54
- "min": [
55
- -0.0625,
56
- 0.625,
57
- -0.0625
58
- ],
59
- "bufferView": 2,
60
- "byteOffset": 0
61
- },
62
- {
63
- "type": "VEC2",
64
- "componentType": 5126,
65
- "count": 24,
66
- "bufferView": 2,
67
- "byteOffset": 12
68
- },
69
- {
70
- "type": "VEC3",
71
- "componentType": 5126,
72
- "count": 24,
73
- "max": [
74
- 0.09375,
75
- 0.15625,
76
- 0.09375
77
- ],
78
- "min": [
79
- -0.15625,
80
- -0.09375,
81
- -0.09375
82
- ],
83
- "bufferView": 3,
84
- "byteOffset": 0
85
- },
86
- {
87
- "type": "VEC2",
88
- "componentType": 5126,
89
- "count": 24,
90
- "bufferView": 3,
91
- "byteOffset": 12
92
- },
93
- {
94
- "type": "VEC3",
95
- "componentType": 5126,
96
- "count": 24,
97
- "max": [
98
- 0.15625,
99
- 0.09375,
100
- 0.0000625000029685907
101
- ],
102
- "min": [
103
- -0.15625,
104
- -0.09375,
105
- 3.469446951953614e-18
106
- ],
107
- "bufferView": 4,
108
- "byteOffset": 0
109
- },
110
- {
111
- "type": "VEC2",
112
- "componentType": 5126,
113
- "count": 24,
114
- "bufferView": 4,
115
- "byteOffset": 12
116
- },
117
- {
118
- "type": "VEC3",
119
- "componentType": 5126,
120
- "count": 24,
121
- "max": [
122
- 0.515625,
123
- -0.01718750037252903,
124
- 0.046875
125
- ],
126
- "min": [
127
- -0.171875,
128
- -0.20468750596046448,
129
- -0.140625
130
- ],
131
- "bufferView": 5,
132
- "byteOffset": 0
133
- },
134
- {
135
- "type": "VEC2",
136
- "componentType": 5126,
137
- "count": 24,
138
- "bufferView": 5,
139
- "byteOffset": 12
140
- }
141
- ],
142
- "bufferViews": [
143
- {
144
- "buffer": 0,
145
- "byteOffset": 0,
146
- "byteLength": 72,
147
- "target": 34963
148
- },
149
- {
150
- "buffer": 0,
151
- "byteOffset": 72,
152
- "byteLength": 768,
153
- "byteStride": 32,
154
- "target": 34962
155
- },
156
- {
157
- "buffer": 0,
158
- "byteOffset": 840,
159
- "byteLength": 480,
160
- "byteStride": 20,
161
- "target": 34962
162
- },
163
- {
164
- "buffer": 0,
165
- "byteOffset": 1320,
166
- "byteLength": 480,
167
- "byteStride": 20,
168
- "target": 34962
169
- },
170
- {
171
- "buffer": 0,
172
- "byteOffset": 1800,
173
- "byteLength": 480,
174
- "byteStride": 20,
175
- "target": 34962
176
- },
177
- {
178
- "buffer": 0,
179
- "byteOffset": 2280,
180
- "byteLength": 480,
181
- "byteStride": 20,
182
- "target": 34962
183
- }
184
- ],
185
- "samplers": [
186
- {
187
- "magFilter": 9728,
188
- "minFilter": 9728,
189
- "wrapS": 33071,
190
- "wrapT": 33071
191
- }
192
- ],
193
- "textures": [
194
- {
195
- "source": 0,
196
- "sampler": 0
197
- }
198
- ],
199
- "images": [
200
- {
201
- "mimeType": "image/png",
202
- "uri": "baseColor.png"
203
- }
204
- ],
205
- "buffers": [
206
- {
207
- "uri": "sword.bin",
208
- "byteLength": 2760
209
- }
210
- ],
211
- "materials": [
212
- {
213
- "alphaMode": "MASK",
214
- "alphaCutoff": 0.05,
215
- "doubleSided": true,
216
- "pbrMetallicRoughness": {
217
- "metallicFactor": 0,
218
- "baseColorTexture": {
219
- "index": 0
220
- }
221
- }
222
- }
223
- ],
224
- "meshes": [
225
- {
226
- "primitives": [
227
- {
228
- "attributes": {
229
- "POSITION": 1,
230
- "NORMAL": 2,
231
- "TEXCOORD_0": 3
232
- },
233
- "mode": 4,
234
- "material": 0,
235
- "indices": 0
236
- }
237
- ]
238
- },
239
- {
240
- "primitives": [
241
- {
242
- "attributes": {
243
- "POSITION": 4,
244
- "TEXCOORD_0": 5,
245
- "NORMAL": 2
246
- },
247
- "mode": 4,
248
- "material": 0,
249
- "indices": 0
250
- }
251
- ]
252
- },
253
- {
254
- "primitives": [
255
- {
256
- "attributes": {
257
- "POSITION": 6,
258
- "TEXCOORD_0": 7,
259
- "NORMAL": 2
260
- },
261
- "mode": 4,
262
- "material": 0,
263
- "indices": 0
264
- }
265
- ]
266
- },
267
- {
268
- "primitives": [
269
- {
270
- "attributes": {
271
- "POSITION": 8,
272
- "TEXCOORD_0": 9,
273
- "NORMAL": 2
274
- },
275
- "mode": 4,
276
- "material": 0,
277
- "indices": 0
278
- }
279
- ]
280
- },
281
- {
282
- "primitives": [
283
- {
284
- "attributes": {
285
- "POSITION": 10,
286
- "TEXCOORD_0": 11,
287
- "NORMAL": 2
288
- },
289
- "mode": 4,
290
- "material": 0,
291
- "indices": 0
292
- }
293
- ]
294
- }
295
- ],
296
- "nodes": [
297
- {
298
- "name": "cube",
299
- "translation": [
300
- 0.01562500004975372,
301
- 0.3515625,
302
- 0.031249999975123153
303
- ],
304
- "mesh": 0
305
- },
306
- {
307
- "name": "cube",
308
- "translation": [
309
- 0,
310
- -0.375,
311
- 4.419015442517403e-26
312
- ],
313
- "mesh": 1
314
- },
315
- {
316
- "name": "cube",
317
- "translation": [
318
- 0.03125,
319
- 0.09531250000000013,
320
- -4.9753690750664564e-11
321
- ],
322
- "mesh": 2
323
- },
324
- {
325
- "name": "cube",
326
- "translation": [
327
- 0,
328
- 2.15625,
329
- -3.469446951953614e-18
330
- ],
331
- "mesh": 3
332
- },
333
- {
334
- "name": "cube",
335
- "translation": [
336
- -0.17187499993780792,
337
- 0.8921875000000001,
338
- 0.0468750002736453
339
- ],
340
- "mesh": 4
341
- }
342
- ],
343
- "scenes": [
344
- {
345
- "name": "blockbench_export",
346
- "nodes": [
347
- 0,
348
- 1,
349
- 2,
350
- 3,
351
- 4
352
- ]
353
- }
354
- ],
355
- "scene": 0
356
- }
@@ -1,136 +0,0 @@
1
- {
2
- "asset": {
3
- "generator": "glTF-Transform v4.1.1",
4
- "version": "2.0"
5
- },
6
- "accessors": [
7
- {
8
- "type": "SCALAR",
9
- "componentType": 5123,
10
- "count": 180,
11
- "bufferView": 0,
12
- "byteOffset": 0
13
- },
14
- {
15
- "type": "VEC3",
16
- "componentType": 5126,
17
- "count": 120,
18
- "max": [
19
- 0.328125,
20
- 1.8984375,
21
- 0.0625
22
- ],
23
- "min": [
24
- -0.359375,
25
- -0.3499999940395355,
26
- -0.125
27
- ],
28
- "bufferView": 1,
29
- "byteOffset": 0
30
- },
31
- {
32
- "type": "VEC3",
33
- "componentType": 5126,
34
- "count": 120,
35
- "bufferView": 1,
36
- "byteOffset": 12
37
- },
38
- {
39
- "type": "VEC2",
40
- "componentType": 5126,
41
- "count": 120,
42
- "bufferView": 1,
43
- "byteOffset": 24
44
- }
45
- ],
46
- "bufferViews": [
47
- {
48
- "buffer": 0,
49
- "byteOffset": 0,
50
- "byteLength": 360,
51
- "target": 34963
52
- },
53
- {
54
- "buffer": 0,
55
- "byteOffset": 360,
56
- "byteLength": 3840,
57
- "byteStride": 32,
58
- "target": 34962
59
- }
60
- ],
61
- "samplers": [
62
- {
63
- "magFilter": 9728,
64
- "minFilter": 9728,
65
- "wrapS": 33071,
66
- "wrapT": 33071
67
- }
68
- ],
69
- "textures": [
70
- {
71
- "source": 0,
72
- "sampler": 0
73
- }
74
- ],
75
- "images": [
76
- {
77
- "mimeType": "image/png",
78
- "uri": "baseColor.png"
79
- }
80
- ],
81
- "buffers": [
82
- {
83
- "uri": "sword.bin",
84
- "byteLength": 4200
85
- }
86
- ],
87
- "materials": [
88
- {
89
- "alphaMode": "MASK",
90
- "alphaCutoff": 0.05,
91
- "doubleSided": true,
92
- "pbrMetallicRoughness": {
93
- "metallicFactor": 0,
94
- "baseColorTexture": {
95
- "index": 0
96
- }
97
- }
98
- }
99
- ],
100
- "meshes": [
101
- {
102
- "primitives": [
103
- {
104
- "attributes": {
105
- "POSITION": 1,
106
- "NORMAL": 2,
107
- "TEXCOORD_0": 3
108
- },
109
- "mode": 4,
110
- "material": 0,
111
- "indices": 0
112
- }
113
- ]
114
- }
115
- ],
116
- "nodes": [
117
- {
118
- "name": "cube",
119
- "translation": [
120
- 0.01562500004975372,
121
- 0.3515625,
122
- 0.031249999975123153
123
- ],
124
- "mesh": 0
125
- }
126
- ],
127
- "scenes": [
128
- {
129
- "name": "blockbench_export",
130
- "nodes": [
131
- 0
132
- ]
133
- }
134
- ],
135
- "scene": 0
136
- }