-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tile.java
84 lines (60 loc) · 1.39 KB
/
Tile.java
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package Com.Game;
import java.awt.Color;
public class Tile{
int value;
Color TileColor;
public Tile(){
value = 0;
}
public Tile( int number ){
value = number;
}
public int getValue(){
return value;
}
public void setValue( int value ){
this.value = value;
}
public String toString(){
return "" + value;
}
public void setColor(){
if ( this.getValue() == 2 ){
TileColor = new Color( 241, 198, 151 );
}
else if ( this.getValue() == 4 ){
TileColor = new Color( 213, 246, 246 );
}
else if ( this.getValue() == 8 ){
TileColor = new Color( 5, 100, 113 );
}
else if ( this.getValue() == 16 ){
TileColor = new Color( 16, 137, 167 );
}
else if ( this.getValue() == 32 ){
TileColor = new Color( 89, 213, 233 );
}
else if ( this.getValue() == 64 ){
TileColor = new Color( 151, 234, 242 );
}
else if ( this.getValue() == 128 ){
TileColor = new Color( 227, 172, 99 );
}
else if ( this.getValue() == 256 ){
TileColor = new Color( 44, 201, 180 );
}
else if ( this.getValue() == 512 ){
TileColor = new Color( 20, 187, 220 );
}
else if ( this.getValue() == 1024 ){
TileColor = new Color( 82, 82, 20 );
}
else{
TileColor = new Color( 49, 49, 12 );
}
}
public Color getColor(){
this.setColor();
return TileColor;
}
}