-
Notifications
You must be signed in to change notification settings - Fork 0
/
Samu.js
70 lines (52 loc) · 1.72 KB
/
Samu.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
import * as THREE from './libs/three.module.js'
import { MTLLoader } from './libs/MTLLoader.js'
import { OBJLoader } from './libs/OBJLoader.js'
import {Enemigo} from './Enemigo.js'
class Samu extends Enemigo{
constructor(){
super();
var that = this;
var materiaLoader = new MTLLoader();
var objectLoader = new OBJLoader();
materiaLoader.load('models/samu_boss/samu.mtl',
function(materials){
objectLoader.setMaterials(materials);
objectLoader.load('models/samu_boss/samu.obj',
function(object){
var modelo = object;
var modelo = object
modelo.scale.set(200,200,200)
that.add(modelo);
},null,null);
});
var geometry = new THREE.BoxGeometry( 8.6, 18, 8.6 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
this.cube = new THREE.Mesh( geometry, material );
this.cube.visible = false
this.add(this.cube)
this.fin_recorrido_z = false
this.fin_recorrido_x = true
this.fin_recorrido_z_2 = true
this.fin_recorrido_x_2 = true
this.signo_recorrido = -1
this.rotateY(Math.PI/2)
this.vida = 5
this.orientacion = Samu.LOOK_AT_DOWN;
this.name = 'Samu'
}
rutaSamu(){
if(this.position.z == -7){
this.signo_recorrido = +1
}
if(this.position.z == 15){
this.signo_recorrido = -1
}
this.position.z += (this.signo_recorrido)*0.25
}
}
//Orientaciones de Samu
Samu.LOOK_AT_UP = 5;
Samu.LOOK_AT_DOWN = 6;
Samu.LOOK_AT_RIGHT = 7;
Samu.LOOK_AT_LEFT = 8;
export { Samu };