-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtela_inicial.lua
302 lines (224 loc) · 8.25 KB
/
tela_inicial.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
---------------------------------------------------------------------------------
--
-- tela_inicial.lua
--
---------------------------------------------------------------------------------
---------------------------------------------------------------------------------
-- Config Global
---------------------------------------------------------------------------------
-- Require composer
---------------------------------------------------------------------------------
local composer = require "composer"
local scene = composer.newScene()
-- Config variaveis
---------------------------------------------------------------------------------
local sceneGroupCreate
-- Config scene group create
---------------------------------------------------------------------------------
local function config_scene_group_create( sceneGroup)
sceneGroupCreate = sceneGroup
return
end
-- Config background
---------------------------------------------------------------------------------
local function config_background( )
local background = display.newImage( "assets/images/bg1.jpg" )
background.x = centerX
background.y = centerY
sceneGroupCreate:insert( background )
return
end
-- Config global
---------------------------------------------------------------------------------
local function config_global( sceneGroup )
config_scene_group_create( sceneGroup )
config_background( )
return
end
---------------------------------------------------------------------------------
-- Header
---------------------------------------------------------------------------------
-- Config header
---------------------------------------------------------------------------------
local function config_header( )
-- local textField1 = display.newEmbossedText({
-- text = "o que é",
-- x = centerX - 65,
-- y = 50,
-- width = 200,
-- fontSize = 55,
-- align = "center",
-- font = "TrashHand"
-- })
-- textField1:setTextColor( 0, 242, 232 )
return
end
---------------------------------------------------------------------------------
-- Body
---------------------------------------------------------------------------------
-- Config logo
---------------------------------------------------------------------------------
local function config_logo( )
local oq1 = display.newImage( "assets/images/oq1.png" )
oq1.x, oq1.y = centerX - 65, 50
oq1.width, oq1.height = 140, 60
local interrogacao = display.newImage( "assets/images/int.png" )
interrogacao.x, interrogacao.y = centerX, centerY - 30
local oq2 = display.newImage( "assets/images/oq2.png" )
oq2.x, oq2.y = centerX + 70, centerY + 45
oq2.width, oq2.height = 110, 60
oq1.xScale, oq1.yScale = 0.01, 0.01
animar_pulsate(oq1)
oq2.xScale, oq2.yScale = 0.01, 0.01
timer.performWithDelay( 800, function( ) animar_pulsate(oq2); end )
local function1, function2
local trans
function function1(e)
transition.to(interrogacao, { time = 500, delay = 500, rotation = -10, onComplete=function2})
end
function function2(e)
transition.to(interrogacao, { time = 500, delay = 500, rotation = 10})
end
timer.performWithDelay( 1500, function( ) transition.to(interrogacao, { time = 3800, delay = 800, rotation=360, transition = easing.outElastic }); end )
local group = display.newGroup()
group:insert( oq1 )
group:insert( interrogacao )
group:insert( oq2 )
sceneGroupCreate:insert( group )
return
end
-- Config play
---------------------------------------------------------------------------------
local function config_play( )
local function onIconTouch( self, event )
if event.phase == "began" then
play_pop_sound( )
composer.gotoScene( "escolher_fase", { effect = "zoomInOutFade" } )
end
return
end
local play = display.newImage("assets/images/play.png")
play.x, play.y = _W / 4.3, _H - 70
play.touch = onIconTouch
play:addEventListener( "touch", play )
sceneGroupCreate:insert( play )
return
end
-- Config creditos
---------------------------------------------------------------------------------
local function config_creditos( )
local function onIconTouch( self, event )
if event.phase == "began" then
play_pop_sound( )
composer.gotoScene( "creditos", { effect = "zoomInOutFade" } )
end
return
end
local play = display.newImage("assets/images/creditos.png")
play.x, play.y = centerX, _H - 70
play.touch = onIconTouch
play:addEventListener( "touch", play )
sceneGroupCreate:insert( play )
return
end
-- Config config
---------------------------------------------------------------------------------
local function config_config( )
local function onIconTouch( self, event )
if event.phase == "began" then
play_pop_sound( )
composer.gotoScene( "configuracoes", { effect = "zoomInOutFade" } )
end
return
end
local config = display.newImage("assets/images/config.png")
config.x, config.y = _W / 1.3, _H - 70
config.touch = onIconTouch
config:addEventListener( "touch", config )
sceneGroupCreate:insert( config )
return
end
local function config_menu( )
config_play( )
config_creditos( )
config_config( )
return
end
-- Config body
---------------------------------------------------------------------------------
local function config_body( )
config_menu( )
return
end
---------------------------------------------------------------------------------
-- Footer
---------------------------------------------------------------------------------
-- Config footer
---------------------------------------------------------------------------------
local function config_footer( )
local texto_autor = display.newText( "por Igor Rocha", 0, 0, native.systemFontBold, 12 )
texto_autor.x, texto_autor.y = centerX, _H - 20
sceneGroupCreate:insert( texto_autor )
return
end
---------------------------------------------------------------------------------
-- "scene:create()"
---------------------------------------------------------------------------------
function scene:create( event )
config_global( self.view )
config_header( )
config_body( )
return
end
---------------------------------------------------------------------------------
-- "scene:show()"
---------------------------------------------------------------------------------
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == "will" ) then
-- Called when the scene is still off screen (but is about to come on screen).
config_logo( )
elseif ( phase == "did" ) then
-- Called when the scene is now on screen.
-- Insert code here to make the scene come alive.
-- Example: start timers, begin animation, play audio, etc.
composer.removeScene( "escolher_fase" )
composer.removeScene( "configuracoes" )
composer.removeScene( "creditos" )
end
return
end
---------------------------------------------------------------------------------
-- "scene:hide()"
---------------------------------------------------------------------------------
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if ( phase == "will" ) then
-- Called when the scene is on screen (but is about to go off screen).
-- Insert code here to "pause" the scene.
-- Example: stop timers, stop animation, stop audio, etc.
elseif ( phase == "did" ) then
-- Called immediately after scene goes off screen.
end
return
end
---------------------------------------------------------------------------------
-- "scene:destroy()"
---------------------------------------------------------------------------------
function scene:destroy( event )
local sceneGroup = self.view
-- Called prior to the removal of scene's view ("sceneGroup").
-- Insert code here to clean up the scene.
-- Example: remove display objects, save state, etc.
return
end
---------------------------------------------------------------------------------
-- Listener setup
---------------------------------------------------------------------------------
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
return scene