-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaser.ts
More file actions
27 lines (21 loc) · 736 Bytes
/
laser.ts
File metadata and controls
27 lines (21 loc) · 736 Bytes
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
/// <reference path="typings/index.d.ts" />
class Laser extends GameObject{
constructor(positionX : number, positionY : number, positionZ : number, g : Game){
super(0x00ff00, 0.1, 0.1, 0.3, 0, g);
this.object.position.set(positionX, positionY, positionZ);
this._speedZ = -0.1;
}
public move() : void {
super.move();
if(this.object.position.z > 10){
this.game.scene.remove(this.object);
}
if(this.object.position.z < -80){
this.game.scene.remove(this.object);
}
}
public remove(index : number) : void {
this.game.scene.remove(this.game.lasers[index].object);
this.game.lasers.splice(index, 1);
}
}