-
Notifications
You must be signed in to change notification settings - Fork 0
/
popUpEnd.lua
executable file
·275 lines (138 loc) · 4.68 KB
/
popUpEnd.lua
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
module(..., package.seeall)
_W = display.contentWidth
_H = display.contentHeight
popUpEndGroup = display.newGroup()
function popUpEnd:init(params, score_value, localGroup)
local insertScore = require("insertScore")
local record_value = insertScore:go(params, score_value)
local bg = display.newImage("ppEnd-bg.png")
bg.x = _W / 2
bg.y = _H / 2
bg.alpha = 0.95
local world = display.newText( params.world, 0, 0, "Komika Axis", 41 )
world.x = 130
world.y = 355
local dash = display.newImage("tratto.png")
dash.x = 150
dash.y = 355
local level = display.newText( params.level, 0, 0, "Komika Axis", 41 )
level.x = 180
level.y = 355
--local completed = display.newImage("level-compl.png")
local completed = display.newText( "Level Completed!", 0, 0, "Komika Axis", 30 )
--completed:setReferencePoint(display.TopLeftReferencePoint)
completed.x = 270
completed.y = 430
--local score = display.newImage("score.png")
local score_label = display.newText( "Score:", 0, 0, "Komika Axis", 24 )
score_label.x = 165
score_label.y = 480
local score = display.newText( score_value, 0, 0, "Komika Axis", 35 )
score.x = 180
score.y = 535
local record_label = display.newText("Record:", 0, 0, "Komika Axis", 17 )
record_label.x = 420
record_label.y = 340
local record = display.newText(record_value, 0, 0, "Komika Axis", 24)
record.x = 370
record.y = 360
local s_stars = display.newGroup()
if (record_value <= 10000) then
star1 = display.newImage("null_star.png")
star2 = display.newImage("null_star.png")
star3 = display.newImage("null_star.png")
elseif (record_value <= 20000) then
star1 = display.newImage("star.png")
star2 = display.newImage("null_star.png")
star3 = display.newImage("null_star.png")
elseif (record_value < 30000) then
star1 = display.newImage("star.png")
star2 = display.newImage("star.png")
star3 = display.newImage("null_star.png")
elseif (record_value >= 30000) then
star1 = display.newImage("star.png")
star2 = display.newImage("star.png")
star3 = display.newImage("star.png")
end
s_stars:insert(star1)
s_stars:insert(star2)
s_stars:insert(star3)
star1.x = 0
star2.x = star1.contentWidth + 10
star3.x = (star1.contentWidth * 2) + 20
s_stars.x = 430
s_stars.y = 345
s_stars.xScale = 0.5
s_stars.yScale = 0.5
local stars = display.newGroup()
if (score_value <= 10000) then
star1 = display.newImage("null_star.png")
star2 = display.newImage("null_star.png")
star3 = display.newImage("null_star.png")
elseif (score_value <= 20000) then
star1 = display.newImage("star.png")
star2 = display.newImage("null_star.png")
star3 = display.newImage("null_star.png")
elseif (score_value < 30000) then
star1 = display.newImage("star.png")
star2 = display.newImage("star.png")
star3 = display.newImage("null_star.png")
elseif (score_value >= 30000) then
star1 = display.newImage("star.png")
star2 = display.newImage("star.png")
star3 = display.newImage("star.png")
end
stars:insert(star1)
stars:insert(star2)
stars:insert(star3)
star1.x = 0
star2.x = star1.contentWidth + 10
star3.x = (star1.contentWidth * 2) + 20
stars.x = 310
stars.y = 500
local popUp_btns = display.newGroup()
local replay = display.newImage("replay.png")
replay.x = 0
replay.y = 0
local select = display.newImage("select.png")
select.x = replay.contentWidth + 30
select.y = 0
local avanti = display.newImage("avanti.png")
avanti.x = (replay.contentWidth * 2) + 60
avanti.y = 0
popUp_btns:insert(replay)
popUp_btns:insert(select)
popUp_btns:insert(avanti)
popUp_btns.x = 180
popUp_btns.y = 630
popUp_btns.xScale = 1.5
popUp_btns.yScale = 1.5
localGroup:insert(bg)
localGroup:insert(world)
localGroup:insert(dash)
localGroup:insert(level)
localGroup:insert(completed)
localGroup:insert(score_label)
localGroup:insert(score)
localGroup:insert(record_label)
localGroup:insert(record)
localGroup:insert(s_stars)
localGroup:insert(stars)
localGroup:insert(popUp_btns)
function red(event)
if (event.phase == "ended") then
audio.stop(bgMusicChannel)
bgMusicChannel = nil
director:changeScene("red", "fade", "black")
end
end
function reload(event)
if (event.phase == "ended") then
director:changeScene("level", "fade", "black")
end
return true
end
replay:addEventListener("touch", reload)
select:addEventListener("touch", red)
return localGroup
end