-
Notifications
You must be signed in to change notification settings - Fork 1
/
sides.pde
41 lines (39 loc) · 874 Bytes
/
sides.pde
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
int getSide(int width, int player) {
if(player == 1) {
if(sides == 21) {
return width/2+250;
}
return width/2-250;
}
else {
if(sides == 21) {
return width/2-250;
}
return width/2+250;
}
}
void checkSideChange() {
int pointsNeeded = (ruleType == 0) ? 5 : 10;
int atGame = (gameType * 2) + 3;
if(currentGame == atGame) {
if(!changedInLastGame) {
if(points[1] == pointsNeeded) {
changeSide();
changedInLastGame = true;
}
else if(points[2] == pointsNeeded) {
changeSide();
changedInLastGame = true;
}
}
}
}
void changeSide() {
if(sides == 12) {
sides = 21;
}
else {
sides = 12;
}
alert(lang.getString("alert-side-change-title"), lang.getString("alert-side-change-text"));
}