-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathloading.lua
104 lines (68 loc) · 2.39 KB
/
loading.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
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
local sprite = require "sprite"
local image
function scene:createScene( event )
local screenGroup = self.view
local options =
{
frames = {},
sheetContentWidth = 1024,
sheetContentHeight = 1024,
}
local frames = options.frames
for j=0,2 do
for i=0,3 do
local element = {
x = i*256,
y = j*256,
width = 256,
height = 256,
}
table.insert( frames, element )
end
end
local element = {
x = 0,
y = 3*256,
width = 469,
height = 256,
}
table.insert( frames, element )
local sheet = graphics.newImageSheet( "mushroom_logo.png", options )
local mushroom = display.newSprite( sheet, { name="mushroom", start=1, count=12, time=900,loopCount=1} )
mushroom.x = display.contentWidth/2
mushroom.y = display.contentHeight/2 - mushroom.height/3
mushroom:play()
local logo = display.newSprite( sheet, { name="logo", start=13, count=1, time=0 } )
logo.x = display.contentWidth/2
logo.y = display.contentHeight/2 + logo.height - mushroom.height/2 logo:scale(0.6,0.6)
screenGroup:insert(logo)
screenGroup:insert( mushroom )
end
function scene:enterScene( event )
local function updateTime()
storyboard.gotoScene( "menu", "fade", 1000 )
end
local clockTimer = timer.performWithDelay( 1000, updateTime, 1 )
end
function scene:exitScene( event )
end
function scene:destroyScene( event )
end
---------------------------------------------------------------------------------
-- END OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
-- "createScene" event is dispatched if scene's view does not exist
scene:addEventListener( "createScene", scene )
-- "enterScene" event is dispatched whenever scene transition has finished
scene:addEventListener( "enterScene", scene )
-- "exitScene" event is dispatched before next scene's transition begins
scene:addEventListener( "exitScene", scene )
-- "destroyScene" event is dispatched before view is unloaded, which can be
-- automatically unloaded in low memory situations, or explicitly via a call to
-- storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( "destroyScene", scene )
---------------------------------------------------------------------------------
return scene