-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tblock.cpp
55 lines (40 loc) · 1.23 KB
/
Tblock.cpp
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
#include "Tblock.h"
#include <iostream>
Tblock::Tblock() {
length = 3;
units[2][0]->initialize("T", uniqueBlockId);
units[2][1]->initialize("T", uniqueBlockId);
units[3][1]->initialize("T", uniqueBlockId);
units[2][2]->initialize("T", uniqueBlockId);
}
void Tblock::rotate(int direction) {
Block::rotate(direction);
if (rotation == 0) {
units[2][0]->initialize("T", uniqueBlockId);
units[2][1]->initialize("T", uniqueBlockId);
units[3][1]->initialize("T", uniqueBlockId);
units[2][2]->initialize("T", uniqueBlockId);
length = 3;
}
else if (rotation == 1) {
units[2][0]->initialize("T", uniqueBlockId);
units[1][1]->initialize("T", uniqueBlockId);
units[2][1]->initialize("T", uniqueBlockId);
units[3][1]->initialize("T", uniqueBlockId);
length = 2;
}
else if (rotation == 2) {
units[3][0]->initialize("T", uniqueBlockId);
units[2][1]->initialize("T", uniqueBlockId);
units[3][1]->initialize("T", uniqueBlockId);
units[3][2]->initialize("T", uniqueBlockId);
length = 3;
}
else if (rotation == 3) {
units[1][0]->initialize("T", uniqueBlockId);
units[2][0]->initialize("T", uniqueBlockId);
units[3][0]->initialize("T", uniqueBlockId);
units[2][1]->initialize("T", uniqueBlockId);
length = 2;
}
}