-
Notifications
You must be signed in to change notification settings - Fork 34
/
loadmenu.lua
64 lines (46 loc) · 1.87 KB
/
loadmenu.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
local storyboard = require( "storyboard" )
local scene = storyboard.newScene()
---------------------------------------------------------------------------------
-- BEGINNING OF YOUR IMPLEMENTATION
---------------------------------------------------------------------------------
local screen = nil
function initializeGame()
require 'init_buttons'
math.randomseed( os.time() )
end
function scene:createScene( event )
screen = self.view
local loadingImage = display.newImageRect( "images/splash_screen.png", 480, 320 )
loadingImage.x = display.contentWidth/2
loadingImage.y = display.contentHeight/2
screen:insert(loadingImage)
local gotoMainMenu = function()
storyboard.gotoScene( "menu" )
end
initializeGame()
local loadMenuTimer = timer.performWithDelay( 1000, gotoMainMenu, 1 )
end
function scene:enterScene( event )
print("Loading screen loaded...")
storyboard.removeAll()
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