-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCoin.ts
39 lines (27 loc) · 865 Bytes
/
Coin.ts
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
import { Material } from './lib/juego/Material.js'
import { Shape } from './lib/juego/Shape.js'
import { Vec2 } from './lib/juego/Vec2.js'
import { CenteredEntity } from './CenteredEntity.js'
export class Coin extends CenteredEntity {
materials: Array<Material> = [];
/* property overrides */
angleVel = 0.08;
constructor( pos: Vec2 ) {
super( pos, 8, 8 );
this.material = new Material( 0, 1.0, 0.7 );
for ( let i = 0; i < 6; i++ ) {
this.materials.push( new Material( i * 60, 1.0, 0.7 ) );
this.materials[i].alpha = 1.0;
this.materials[i].emit = 1.0;
}
}
getOwnShapes(): Array<Shape> {
let shape = Shape.makeCircle( new Vec2(), this.width, 6 );
shape.parent = this;
shape.material = this.material;
for ( let i = 0; i < shape.edges.length; i++ ) {
shape.edges[i].material = this.materials[i];
}
return [shape];
}
}