forked from cgolden15/tetris
-
Notifications
You must be signed in to change notification settings - Fork 3
/
WallKicks.js
67 lines (55 loc) · 1.99 KB
/
WallKicks.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
var WALL_KICK_OFFSETS = {};
/*
0 -> starting orientation
1 -> 1 turn cw
2 -> 2 turns
3-> 1 turn ccw
non-I blocks
L->2 ( 0, 0) (-1, 0) (-1,-1) ( 0,+2) (-1,+2)
L->0 ( 0, 0) (-1, 0) (-1,-1) ( 0,+2) (-1,+2)
2->R ( 0, 0) (-1, 0) (-1,+1) ( 0,-2) (-1,-2)
2->L ( 0, 0) (+1, 0) (+1,+1) ( 0,-2) (+1,-2)
R->0 ( 0, 0) (+1, 0) (+1,-1) ( 0,+2) (+1,+2)
R->2 ( 0, 0) (+1, 0) (+1,-1) ( 0,+2) (+1,+2)
0->L ( 0, 0) (+1, 0) (+1,+1) ( 0,-2) (+1,-2)
0->R ( 0, 0) (-1, 0) (-1,+1) ( 0,-2) (-1,-2)
I block
0->R ( 0, 0) (-2, 0) (+1, 0) (-2,-1) (+1,+2)
0->L ( 0, 0) (-1, 0) (+2, 0) (-1,+2) (+2,-1)
R->2 ( 0, 0) (-1, 0) (+2, 0) (-1,+2) (+2,-1)
R->0 ( 0, 0) (+2, 0) (-1, 0) (+2,+1) (-1,-2)
2->L ( 0, 0) (+2, 0) (-1, 0) (+2,+1) (-1,-2)
2->R ( 0, 0) (+1, 0) (-2, 0) (+1,-2) (-2,+1)
L->0 ( 0, 0) (+1, 0) (-2, 0) (+1,-2) (-2,+1)
L->2 ( 0, 0) (-2, 0) (+1, 0) (-2,-1) (+1,+2)
*/
WALL_KICK_OFFSETS.standard = [
{
cw: [{x:0,y:0}, {x:-1,y:0}, {x:-1,y:-1}, {x:0,y:2}, {x:-1,y:2}],
ccw: [{x:0,y:0}, {x:1,y:0}, {x:1,y:-1}, {x:0,y:2}, {x:1,y:2}]
},{
cw: [{x:0,y:0}, {x:1,y:0}, {x:1,y:1}, {x:0,y:-2}, {x:1,y:-2}],
ccw: [{x:0,y:0}, {x:1,y:0}, {x:1,y:1}, {x:0,y:-2}, {x:1,y:-2}]
},{
cw: [{x:0, y:0}, {x:1,y:0}, {x:1,y:-1}, {x:0,y:2}, {x:1,y:2}],
ccw: [{x:0, y:0}, {x:-1, y:0}, {x:-1,y:-1}, {x:0,y:2}, {x:-1,y:2}]
},{
cw: [{x:0,y:0}, {x:-1,y:0}, {x:-1,y:1}, {x:0,y:-2}, {x:-1,y:-2}],
ccw: [{x:0,y:0}, {x:-1,y:0}, {x:-1,y:1}, {x:0,y:-2}, {x:-1,y:-2}]
}
];
WALL_KICK_OFFSETS.i_block = [
{
cw: [{x:0,y:0}, {x:-2,y:0}, {x:1,y:0}, {x:-2,y:1}, {x:1,y:-2}],
ccw: [{x:0,y:0}, {x:-1,y:0}, {x:2,y:0}, {x:-1,y:-2}, {x:2,y:1}]
},{
cw: [{x:0,y:0}, {x:-1,y:0}, {x:2,y:0}, {x:-1,y:-2}, {x:2,y:1}],
ccw: [{x:0,y:0}, {x:2,y:0}, {x:-1,y:0}, {x:2,y:-1}, {x:-1,y:2}]
},{
cw: [{x:0,y:0}, {x:2,y:0}, {x:-1,y:0}, {x:2,y:-1}, {x:-1,y:2}],
ccw: [{x:0,y:0}, {x:1,y:0}, {x:-2,y:0}, {x:1,y:2}, {x:-2,y:-1}]
},{
cw: [{x:0,y:0}, {x:1,y:0}, {x:-2,y:0}, {x:1,y:2}, {x:-2,y:1}],
ccw: [{x:0,y:0}, {x:-2,y:0}, {x:1,y:0}, {x:-2,y:1}, {x:1,y:-2}]
}
];