-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.kv
110 lines (96 loc) · 2.42 KB
/
game.kv
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#:set padding 10
FloatLayout:
orientation: 'vertical' if root.height < root.width else 'horizontal'
canvas:
Color:
rgb: 0xfa / 255., 0xf8 / 255., 0xef / 255.
BorderImage:
pos: self.pos
size: self.size
source: './image/round.png'
BoxLayout:
pos_hint: {'center_x': 0.5, 'y': 0.75}
size_hint_y: 0.25
spacing: '10dp'
padding: '5dp'
orientation: 'horizontal'
Label:
text: '2048'
font_size: min(self.height, self.width) / 2.
color: 0x77 / 255., 0x6e / 255., 0x65 / 255., 1.
bold: True
BoxLayout:
orientation: 'vertical'
spacing: '10dp'
canvas.before:
Color:
rgb: 0xbb / 255., 0xad / 255., 0xa0 / 255.
BorderImage:
pos: self.pos
size: self.size
source: 'image/round.png'
Label:
text: 'SCORE'
color: 0xee / 255., 0xe4 / 255., 0xda / 255., 1.
font_size: self.height / 1.5
size_hint_y: .8
bold: True
Label:
text: str(board.score)
font_size: self.height / 1.5
bold: True
Board:
id: board
canvas:
Color:
rgba:0xbb / 255., 0xad / 255., 0xa0 / 255.,.8
BorderImage:
pos: self.pos
size: self.size
source: 'image/round.png'
pos_hint: {'center_x': 0.5, 'center_y': 0.375}
size_hint: (None, None)
center: root.center
size: [min(root.width, root.height*.75) - 2 * padding] * 2
AnchorLayout:
id: end
pos: board.pos
size: board.size
opacity: 0
canvas:
Color:
rgba: 0xfa / 255., 0xf8 / 255., 0xef / 255., self.opacity - 0.2
BorderImage:
pos: self.pos
size: self.size
source: 'image/round.png'
BoxLayout:
orientation: 'vertical'
padding: '10dp'
spacing: '20dp'
Label:
id: end_label
font_size: min(self.height, self.width) / 3.
color: 0x77 / 255., 0x6e / 255., 0x65 / 255., 1.
bold: True
text: 'Game\nover!'
halign: 'center'
Button:
text: 'Restart'
on_press: self.parent.parent.parent.restart() if end.opacity == 1. else None
font_size: '20dp'
<Tile>:
canvas:
Color:
rgb: self.color
BorderImage:
pos: self.pos
size: self.size
source: './image/round.png'
Label:
pos: root.pos
size: root.size
bold: True
color: root.number_color
font_size: root.font_size
text: str(root.number)