forked from trungvose/angular-tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
/
L.ts
42 lines (39 loc) · 773 Bytes
/
L.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
40
41
42
import { Piece } from './piece';
import { Shapes } from './shape';
import { PieceRotation, PieceTypes } from './piece-enum';
const ShapesL: Shapes = [];
ShapesL[PieceRotation.Deg0] = [
[0, 0, 0, 0],
[1, 0, 0, 0],
[1, 0, 0, 0],
[1, 1, 0, 0]
];
ShapesL[PieceRotation.Deg90] = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[1, 1, 1, 0],
[1, 0, 0, 0]
];
ShapesL[PieceRotation.Deg180] = [
[0, 0, 0, 0],
[1, 1, 0, 0],
[0, 1, 0, 0],
[0, 1, 0, 0]
];
ShapesL[PieceRotation.Deg270] = [
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 1, 0],
[1, 1, 1, 0]
];
export class PieceL extends Piece {
constructor(x: number, y: number) {
super(x, y);
this.type = PieceTypes.L;
this.next = [
[0, 0, 1, 0],
[1, 1, 1, 0]
];
this.setShapes(ShapesL);
}
}