-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2458 lines (2180 loc) · 104 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
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<title>Space Bomb</title>
<link rel="shortcut icon" href="assets/SBProfile.png">
<script type="text/javascript" src="js/libs/jquery/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/libs/three/three.js"></script>
<script type="text/javascript" src="js/libs/three/MTLLoader.js"></script>
<script type="text/javascript" src="js/libs/three/OBJLoader.js"></script>
<script type="text/javascript" src="js/mifacebook.js"></script>
<style>
#bar-section {
height: 5%;
width: 99.7%;
background-color: blue;
}
#bar-imagenes {
height: 90%;
width: 2%;
}
#bar-imagenes-menu {
float: right;
height: 90%;
width: 7%;
}
#bar-label {
font-size: 200%;
color: white;
}
#bar-label-points {
font-size: 200%;
color: white;
}
#bar-label-life {
font-size: 200%;
color: white;
}
#menu-principal {
height: 100%;
width: 100%;
}
#menu-principal-background {
height: 100%;
width: 100%;
}
#menu-principal-button01 {
position: absolute;
top: 25%;
left: 50%;
transform: translate(-50%, -50%);
height: 15%;
width: 25%;
}
#menu-principal-button02 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
height: 15%;
width: 25%;
}
#menu-principal-button03 {
position: absolute;
top: 75%;
left: 50%;
transform: translate(-50%, -50%);
height: 15%;
width: 25%;
}
#screen-end-level {
position: absolute;
top: 25%;
left: 25%;
height: 50.0%;
width: 50.0%;
background-color: 653257;
}
#screen-end-win {
position: absolute;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
height: 50%;
width: 95%;
}
#screen-end-lose {
position: absolute;
top: 70%;
left: 50%;
transform: translate(-50%, -50%);
height: 50%;
width: 95%;
}
#screen-end-bomb {
position: absolute;
top: 30%;
left: 50%;
transform: translate(-50%, -50%);
height: 50%;
width: 25%;
}
#screen-end-facebookLogo {
position: absolute;
top: 90%;
left: 50%;
transform: translate(-50%, -50%);
height: 8%;
width: 15%;
}
</style>
<script id="vertexShader" type="x-shader/x-vertex">
varying vec2 vUv; void main() { vUv = uv; gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); }
</script>
<script id="fragmentShader" type="x-shader/x-vertex">
uniform sampler2D baseTexture; uniform float baseSpeed; uniform sampler2D noiseTexture; uniform float noiseScale; uniform float alpha; uniform float time; varying vec2 vUv; void main() { vec2 uvTimeShift = vUv + vec2( -0.7, 1.5 ) * time * baseSpeed; vec4
noiseGeneratorTimeShift = texture2D( noiseTexture, uvTimeShift ); vec2 uvNoiseTimeShift = vUv + noiseScale * vec2( noiseGeneratorTimeShift.r, noiseGeneratorTimeShift.b ); vec4 baseColor = texture2D( baseTexture, uvNoiseTimeShift ); baseColor.a
= alpha; gl_FragColor = baseColor; }
</script>
<script type="text/javascript">
var customUniforms2;
var statusGameEnviroment = 0;
var scene;
var camera;
var renderer;
var controls;
var objects = [];
var clock;
var deltaTime;
var keys = {};
var volumenGlobal = 0.5;
var personaje1;
var personaje2;
var bombsCharacter1 = [];
var bombsCharacter2 = [];
var flamesCharacter1 = [];
var flamesCharacter2 = [];
var scenePilaresColision = [];
var rayCaster;
var rayCasterBomb;
var movimientoPersonaje1 = {
MovX: 0,
MovY: 0,
MovZ: 0,
Rotate: 0,
blockPersonajeW: false,
blockPersonajeA: false,
blockPersonajeS: false,
blockPersonajeD: false
};
var movimientoPersonaje2 = {
MovX: 0,
MovY: 0,
MovZ: 0,
Rotate: 0,
blockPersonajeW: false,
blockPersonajeA: false,
blockPersonajeS: false,
blockPersonajeD: false
};
var waterAnimation = 0;
var waterObject;
var systemGameLevel01 = {
lifeCharacter: [3, 3],
timeMin: 3,
timeSeg: 0,
conditionLevel: 0,
active: 0,
points: 0
}
var portalLevelStadistics = {
MovX: 28,
MovY: -20,
MovZ: -2,
status: false,
open: false
}
var portalLevel;
var portalLevelClose;
var portalLevelOpen;
var enemyAndlarCharacters = [];
var enemys = {
Andlar: 3,
Beast: 0,
totalEnemy: 3
}
var segundos = systemGameLevel01.timeSeg;
var minuto = systemGameLevel01.timeMin;
var isWorldReady = [false, false];
$(document).ready(function() {
optionsCicle();
});
function loadOBJWithMTL(path, objFile, mtlFile, onLoadCallback) {
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath(path);
mtlLoader.load(mtlFile, (materials) => {
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath(path);
objLoader.load(objFile, (object) => {
onLoadCallback(object);
});
});
}
function onKeyDown(event) {
keys[String.fromCharCode(event.keyCode)] = true;
}
function onKeyUp(event) {
keys[String.fromCharCode(event.keyCode)] = false;
}
function render() {
requestAnimationFrame(render);
deltaTime = clock.getDelta();
//console.log(milisegundos);
waterFunction();
timeLevel1();
var yaw = 0;
var forward = 0;
if (keys["A"]) {
if (movimientoPersonaje1.blockPersonajeA == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje1.MovX -= 8 * deltaTime;
console.log("Movx" + movimientoPersonaje1.MovX);
//yaw = 5;
}
} else if (keys["D"]) {
if (movimientoPersonaje1.blockPersonajeD == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje1.MovX += 8 * deltaTime;
console.log("Movx" + movimientoPersonaje1.MovX);
//yaw = -5;
}
}
if (keys["W"]) {
if (movimientoPersonaje1.blockPersonajeW == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje1.MovZ -= 8 * deltaTime;
console.log("movz" + movimientoPersonaje1.MovZ);
//forward = -20;
}
} else if (keys["S"]) {
if (movimientoPersonaje1.blockPersonajeS == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje1.MovZ += 8 * deltaTime;
console.log("movz" + movimientoPersonaje1.MovZ);
//forward = 20;
}
}
if (keys["E"]) {
if (personaje1.dataCharacter.timeSpam == false && systemGameLevel01.conditionLevel == 0) {
personaje1.dataCharacter.timeSpam = true;
if (personaje1.dataCharacter.actualBomb >= 3) {
personaje1.dataCharacter.actualBomb = 0;
}
//console.log("Bomba actual: " + personaje1.dataCharacter.actualBomb);
dropBomb1();
personaje1.dataCharacter.actualBomb += 1;
setTimeout(enableBomb, 1000);
}
}
if (isWorldReady[0] && isWorldReady[1]) {
//camera.rotation.y += yaw * deltaTime;
//camera.translateZ(forward * deltaTime);
updateCharacter1();
colisionWorldPilar();
enemyLogicAndlar();
updatePortalLevel();
levelStatus();
if (statusGameEnviroment == 3) {
//debugger;
renderPlayer2();
}
//colisionWorldBlock();
}
renderer.render(scene, camera);
}
function renderPlayer2() {
//requestAnimationFrame(render);
//deltaTime = clock.getDelta();
//console.log(milisegundos);
//waterFunction();
//timeLevel1();
var yaw = 0;
var forward = 0;
if (keys["J"]) {
if (movimientoPersonaje2.blockPersonajeA == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje2.MovX -= 8 * deltaTime;
console.log("Movx" + movimientoPersonaje2.MovX);
//yaw = 5;
}
} else if (keys["L"]) {
if (movimientoPersonaje2.blockPersonajeD == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje2.MovX += 8 * deltaTime;
console.log("Movx" + movimientoPersonaje2.MovX);
//yaw = -5;
}
}
if (keys["I"]) {
if (movimientoPersonaje2.blockPersonajeW == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje2.MovZ -= 8 * deltaTime;
console.log("movz" + movimientoPersonaje2.MovZ);
//forward = -20;
}
} else if (keys["K"]) {
if (movimientoPersonaje2.blockPersonajeS == false && systemGameLevel01.conditionLevel == 0) {
movimientoPersonaje2.MovZ += 8 * deltaTime;
console.log("movz" + movimientoPersonaje2.MovZ);
//forward = 20;
}
}
if (keys["O"]) {
if (personaje2.dataCharacter.timeSpam == false && systemGameLevel01.conditionLevel == 0) {
personaje2.dataCharacter.timeSpam = true;
if (personaje2.dataCharacter.actualBomb >= 3) {
personaje2.dataCharacter.actualBomb = 0;
}
//console.log("Bomba actual: " + personaje1.dataCharacter.actualBomb);
dropBomb2();
personaje2.dataCharacter.actualBomb += 1;
setTimeout(enableBomb2, 1000);
}
}
if (isWorldReady[0] && isWorldReady[1]) {
//camera.rotation.y += yaw * deltaTime;
//camera.translateZ(forward * deltaTime);
updateCharacter2();
colisionWorldPilar2();
//colisionWorldPilar();
//enemyLogicAndlar();
//updatePortalLevel();
//levelStatus();
//colisionWorldBlock();
}
//renderer.render(scene, camera);
}
function setupScene() {
$("#menu-principal").remove();
$("body").append("<div id='bar-section'></div>");
var visibleSize = {
width: window.innerWidth - 20,
height: (window.innerHeight - (window.innerWidth * 0.05))
};
rayCaster = new THREE.Raycaster();
rayCasterBomb = new THREE.Raycaster();
clock = new THREE.Clock();
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera(75, visibleSize.width / visibleSize.height, 0.1, 150);
camera.position.z = 22;
camera.position.y = 60;
camera.rotation.x = -1.3;
renderer = new THREE.WebGLRenderer({
precision: "mediump"
});
renderer.setClearColor(new THREE.Color(0, 0, 0));
renderer.setPixelRatio(visibleSize.width / visibleSize.height);
renderer.setSize(visibleSize.width, visibleSize.height);
var ambientLight = new THREE.AmbientLight(new THREE.Color(1, 1, 1), 1.0);
scene.add(ambientLight);
var directionalLight = new THREE.DirectionalLight(new THREE.Color(1, 1, 0), 0.4);
directionalLight.position.set(0, 0, 1);
scene.add(directionalLight);
var grid = new THREE.GridHelper(50, 10, 0xffffff, 0xffffff);
grid.position.y = -1;
scene.add(grid);
$("#bar-section").append("<label id='bar-label-points'>0</label><img id='bar-imagenes' src='assets/clock.png'><label id='bar-label'>0:00</label><img id='bar-imagenes' src='assets/lifes.png'><label id='bar-label-life'>" +
systemGameLevel01.lifeCharacter[0] + "</label><input id='bar-musicVolume'type='range' min='0' max='1' step='0.01'><img id='bar-imagenes-menu' src='assets/menu.png'>");
$("#scene-section").append(renderer.domElement);
$("#bar-musicVolume").on("click", function() {
volumenGlobal = document.getElementById("bar-musicVolume").value;
$('#audioTheme').prop("volume", volumenGlobal);
console.log(volumenGlobal);
});
$("#bar-imagenes-menu").on("click", function() {
//$("#audioTheme")[0].play();
statusGameEnviroment = 0;
location.reload();
});
shadersWaterfunction();
}
function waterFunction() {
customUniforms2.time.value += deltaTime;
waterAnimation += .1;
var a = Math.sin(waterAnimation / 20) * 1;
waterObject.position.y = a + 2;
//console.log(a);
/*
static float waterMov = 0;
waterMov += .1;
float A = sin(waterMov) * 20;*/
}
function shadersWaterfunction() {
var noiseTexture = new THREE.ImageUtils.loadTexture('assets/cloud.png');
noiseTexture.wrapS = noiseTexture.wrapT = THREE.RepeatWrapping;
var waterTexture = new THREE.ImageUtils.loadTexture('assets/water.jpg');
waterTexture.wrapS = waterTexture.wrapT = THREE.RepeatWrapping;
// use "this." to create global object
this.customUniforms2 = {
baseTexture: {
type: "t",
value: waterTexture
},
baseSpeed: {
type: "f",
value: 1.15
},
noiseTexture: {
type: "t",
value: noiseTexture
},
noiseScale: {
type: "f",
value: 0.2
},
alpha: {
type: "f",
value: 0.3
},
time: {
type: "f",
value: 1.0
}
};
// create custom material from the shader code above
// that is within specially labeled script tags
var customMaterial2 = new THREE.ShaderMaterial({
uniforms: customUniforms2,
vertexShader: document.getElementById('vertexShader').textContent,
fragmentShader: document.getElementById('fragmentShader').textContent
});
// other material properties
customMaterial2.side = THREE.DoubleSide;
customMaterial2.transparent = true;
// apply the material to a surface
var flatGeometry = new THREE.PlaneGeometry(300, 300);
var surface = new THREE.Mesh(flatGeometry, customMaterial2);
surface.position.set(0, 2, 0);
//surface.rotation.x = 1.1;
surface.rotation.x = THREE.Math.degToRad(90);
waterObject = surface;
//console.log(surface);
scene.add(surface);
}
function models() {
if (statusGameEnviroment >= 1) {
loadOBJWithMTL("assets/", "personajePrinc01.obj", "personajePrinc01.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 2;
object.scale.y = 2;
object.scale.z = 2;
object.rayos = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
object.dataCharacter = {
timeSpam: false,
maxBomb: 3,
actualBomb: 0
}
personaje1 = object;
scene.add(personaje1);
isWorldReady[0] = true;
});
if (statusGameEnviroment == 3) {
loadOBJWithMTL("assets/", "personajePrinc01.obj", "personajePrinc01.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 2;
object.scale.y = 2;
object.scale.z = 2;
object.rayos = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
object.dataCharacter = {
timeSpam: false,
maxBomb: 3,
actualBomb: 0
}
personaje2 = object;
scene.add(personaje2);
isWorldReady[0] = true;
});
}
if (statusGameEnviroment == 1 || statusGameEnviroment == 3) {
loadOBJWithMTL("assets/", "enemyAndlar.obj", "enemyAndlar.mtl", (object) => {
//object.position.z = 0;
object.position.y = 2;
object.scale.x = 4;
object.scale.y = 4;
object.scale.z = 4;
//object.rotation.y = THREE.Math.degToRad(180);
object.userData = {
type: true,
destroy: false,
typeOf: 1,
directionCharacter: 0
}
for (var i = 0; i < enemys.Andlar; i++) {
enemyAndlarCharacters[i] = object.clone();
enemyAndlarCharacters[i].rayosEnemy = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
scenePilaresColision.push(enemyAndlarCharacters[i]);
scene.add(enemyAndlarCharacters[i]);
}
enemysParamsInicials();
//console.log(enemyAndlarCharacters);
isWorldReady[0] = true;
});
}
if (statusGameEnviroment == 2) {
loadOBJWithMTL("assets/", "enemyAndlar.obj", "enemyAndlar.mtl", (object) => {
//object.position.z = 0;
object.position.y = 2;
object.scale.x = 4;
object.scale.y = 4;
object.scale.z = 4;
//object.rotation.y = THREE.Math.degToRad(180);
object.userData = {
type: true,
destroy: false,
typeOf: 1,
directionCharacter: 0
}
enemys.Andlar = 5;
enemys.totalEnemy = 5;
for (var i = 0; i < enemys.Andlar; i++) {
enemyAndlarCharacters[i] = object.clone();
enemyAndlarCharacters[i].rayosEnemy = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
scenePilaresColision.push(enemyAndlarCharacters[i]);
scene.add(enemyAndlarCharacters[i]);
}
enemysParamsInicialsLevel02();
//console.log(enemyAndlarCharacters);
isWorldReady[0] = true;
});
}
loadOBJWithMTL("assets/", "exitDoorBase.obj", "exitDoorBase.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 2;
object.scale.x = 1;
object.scale.y = 1;
object.scale.z = 1;
//object.rotation.y = THREE.Math.degToRad(180);
portalLevel = object;
portalLevelSetup();
scene.add(portalLevel);
isWorldReady[0] = true;
});
loadOBJWithMTL("assets/", "exitDoorClose.obj", "exitDoorClose.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 2;
object.scale.x = 1;
object.scale.y = 1;
object.scale.z = 1;
object.userData = {
type: false,
destroy: false,
typeOf: 2
}
portalLevelClose = object;
scenePilaresColision.push(portalLevelClose);
scene.add(portalLevelClose);
isWorldReady[0] = true;
});
loadOBJWithMTL("assets/", "exitDoorOpen.obj", "exitDoorOpen.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 2;
object.scale.x = 1;
object.scale.y = 1;
object.scale.z = 1;
object.userData = {
type: false,
destroy: false,
typeOf: 2
}
portalLevelOpen = object;
scenePilaresColision.push(portalLevelOpen);
scene.add(portalLevelOpen);
isWorldReady[0] = true;
});
loadOBJWithMTL("assets/", "itemBombN.obj", "itemBombN.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 3;
object.scale.y = 3;
object.scale.z = 3;
object.userData = {
MovX: 0,
MovY: 0,
MovZ: 0,
animationBomb: false,
actualBomb: false
}
for (var i = 0; i < 3; i++) {
bombsCharacter1[i] = object.clone();
bombsCharacter1[i].rayosBomb = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
bombsCharacter1[i].position.y = -10;
scene.add(bombsCharacter1[i]);
}
//console.log(bombsCharacter1);
isWorldReady[0] = true;
});
loadOBJWithMTL("assets/", "resourceFire.obj", "resourceFire.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 3;
object.scale.y = 3;
object.scale.z = 3;
object.userData = {
MovX: 0,
MovY: 0,
MovZ: 0,
animationFire: false,
actualFire: false
}
for (var i = 0; i < 5; i++) {
flamesCharacter1[i] = object.clone();
flamesCharacter1[i].position.y = -10;
scene.add(flamesCharacter1[i]);
}
//scene.add(object);
isWorldReady[0] = true;
});
if (statusGameEnviroment == 3) {
debugger;
loadOBJWithMTL("assets/", "itemBombN.obj", "itemBombN.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 3;
object.scale.y = 3;
object.scale.z = 3;
object.userData = {
MovX: 0,
MovY: 0,
MovZ: 0,
animationBomb: false,
actualBomb: false
}
for (var i = 0; i < 3; i++) {
bombsCharacter2[i] = object.clone();
bombsCharacter2[i].rayosBomb = [
new THREE.Vector3(0, 0, 1), //abajo
new THREE.Vector3(0, 0, -1), //arriba
new THREE.Vector3(1, 0, 0), //Lado derecha R
new THREE.Vector3(-1, 0, 0) //Lado
]
bombsCharacter2[i].position.y = -10;
scene.add(bombsCharacter2[i]);
}
//console.log(bombsCharacter2);
isWorldReady[0] = true;
});
loadOBJWithMTL("assets/", "resourceFire.obj", "resourceFire.mtl", (object) => {
//object.position.z = 0;
//object.position.y = 1;
object.scale.x = 3;
object.scale.y = 3;
object.scale.z = 3;
object.userData = {
MovX: 0,
MovY: 0,
MovZ: 0,
animationFire: false,
actualFire: false
}
for (var i = 0; i < 5; i++) {
flamesCharacter2[i] = object.clone();
flamesCharacter2[i].position.y = -10;
scene.add(flamesCharacter2[i]);
}
//scene.add(object);
isWorldReady[0] = true;
});
}
//Origen x-42, z-37, y2
//Bloqueas destruibles
loadOBJWithMTL("assets/", "sceneBlock.obj", "sceneBlock.mtl", (object) => {
//object.position.z = 0;
object.position.y = 2;
object.position.x = 0;
object.position.z = -37;
object.scale.x = 3.0;
object.scale.y = 3.0;
object.scale.z = 3.0;
object.userData = {
type: true,
destroy: false,
typeOf: 0
}
//Columna1
var worldBlock01 = object.clone();
worldBlock01.position.z = -9;
worldBlock01.position.x = -42;
var worldBlock02 = object.clone();
worldBlock02.position.z = -2;
worldBlock02.position.x = -42;
var worldBlock03 = object.clone();
worldBlock03.position.z = 5;
worldBlock03.position.x = -42;
var worldBlock04 = object.clone();
worldBlock04.position.z = 19;
worldBlock04.position.x = -42;
//Columna2
var worldBlock05 = object.clone();
worldBlock05.position.z = -23;
worldBlock05.position.x = -35;
var worldBlock06 = object.clone();
worldBlock06.position.z = 5;
worldBlock06.position.x = -35;
var worldBlock07 = object.clone();
worldBlock07.position.z = 19;
worldBlock07.position.x = -35;
//Columna3
var worldBlock08 = object.clone();
worldBlock08.position.z = -30;
worldBlock08.position.x = -28;
var worldBlock09 = object.clone();
worldBlock09.position.z = 26;
worldBlock09.position.x = -28;
//Columna4
var worldBlock10 = object.clone();
worldBlock10.position.z = -23;
worldBlock10.position.x = -21;
var worldBlock11 = object.clone();
worldBlock11.position.z = -9;
worldBlock11.position.x = -21;
var worldBlock12 = object.clone();
worldBlock12.position.z = 5;
worldBlock12.position.x = -21;
var worldBlock13 = object.clone();
worldBlock13.position.z = 19;
worldBlock13.position.x = -21;
//Columna5
var worldBlock14 = object.clone();
worldBlock14.position.z = -30;
worldBlock14.position.x = -14;
var worldBlock15 = object.clone();
worldBlock15.position.z = -23;
worldBlock15.position.x = -14;
var worldBlock16 = object.clone();
worldBlock16.position.z = -16;
worldBlock16.position.x = -14;
var worldBlock17 = object.clone();
worldBlock17.position.z = -9;
worldBlock17.position.x = -14;
var worldBlock18 = object.clone();
worldBlock18.position.z = -2;
worldBlock18.position.x = -14;
var worldBlock19 = object.clone();
worldBlock19.position.z = 5;
worldBlock19.position.x = -14;
var worldBlock20 = object.clone();
worldBlock20.position.z = 12;
worldBlock20.position.x = -14;
var worldBlock21 = object.clone();
worldBlock21.position.z = 19;
worldBlock21.position.x = -14;
var worldBlock22 = object.clone();
worldBlock22.position.z = 26;
worldBlock22.position.x = -14;
//Columna 6
var worldBlock23 = object.clone();
worldBlock23.position.z = -23;
worldBlock23.position.x = -7;
//Columna 7
var worldBlock24 = object.clone();
worldBlock24.position.z = -23;
worldBlock24.position.x = 0;
var worldBlock25 = object.clone();
worldBlock25.position.z = 26;
worldBlock25.position.x = 0;
var worldBlock26 = object.clone();
worldBlock26.position.z = 33;
worldBlock26.position.x = 0;
//Columna 8
var worldBlock27 = object.clone();
worldBlock27.position.z = -23;
worldBlock27.position.x = 7;
//Columna 9
var worldBlock28 = object.clone();
worldBlock28.position.z = -23;
worldBlock28.position.x = 14;
var worldBlock29 = object.clone();
worldBlock29.position.z = -16;
worldBlock29.position.x = 14;
var worldBlock30 = object.clone();
worldBlock30.position.z = -9;
worldBlock30.position.x = 14;
var worldBlock31 = object.clone();
worldBlock31.position.z = -2;
worldBlock31.position.x = 14;
var worldBlock32 = object.clone();
worldBlock32.position.z = 5;
worldBlock32.position.x = 14;
var worldBlock33 = object.clone();
worldBlock33.position.z = 12;
worldBlock33.position.x = 14;
var worldBlock34 = object.clone();
worldBlock34.position.z = 19;
worldBlock34.position.x = 14;
//Columna 10
var worldBlock35 = object.clone();
worldBlock35.position.z = -23;
worldBlock35.position.x = 21;
var worldBlock36 = object.clone();
worldBlock36.position.z = -9;
worldBlock36.position.x = 21;
var worldBlock37 = object.clone();
worldBlock37.position.z = 5;
worldBlock37.position.x = 21;
var worldBlock38 = object.clone();
worldBlock38.position.z = 19;
worldBlock38.position.x = 21;
//Columna 11
var worldBlock39 = object.clone();
worldBlock39.position.z = -16;
worldBlock39.position.x = 28;
var worldBlock40 = object.clone();
worldBlock40.position.z = -9;
worldBlock40.position.x = 28;
var worldBlock41 = object.clone();
worldBlock41.position.z = -2;
worldBlock41.position.x = 28;
var worldBlock42 = object.clone();
worldBlock42.position.z = 5;
worldBlock42.position.x = 28;
var worldBlock43 = object.clone();
worldBlock43.position.z = 12;
worldBlock43.position.x = 28;
var worldBlock44 = object.clone();
worldBlock44.position.z = 26;
worldBlock44.position.x = 28;
//Columna 12
var worldBlock45 = object.clone();
worldBlock45.position.z = -23;
worldBlock45.position.x = 35;
var worldBlock46 = object.clone();
worldBlock46.position.z = -9;
worldBlock46.position.x = 35;
var worldBlock47 = object.clone();
worldBlock47.position.z = 5;
worldBlock47.position.x = 35;
var worldBlock48 = object.clone();
worldBlock48.position.z = 19;
worldBlock48.position.x = 35;
//Columna 13
var worldBlock49 = object.clone();
worldBlock49.position.z = -23;
worldBlock49.position.x = 42;
var worldBlock50 = object.clone();
worldBlock50.position.z = -16;
worldBlock50.position.x = 42;
var worldBlock51 = object.clone();
worldBlock51.position.z = -2;
worldBlock51.position.x = 42;
var worldBlock52 = object.clone();
worldBlock52.position.z = 12;
worldBlock52.position.x = 42;
var worldBlock53 = object.clone();
worldBlock53.position.z = 19;
worldBlock53.position.x = 42;
scenePilaresColision.push(object);
scenePilaresColision.push(worldBlock01);
scenePilaresColision.push(worldBlock02);