forked from n8fr8/Ghosts-vs.-Monsters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadlevel2.lua
47 lines (36 loc) · 1.17 KB
/
loadlevel2.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
--
-- Abstract: Ghosts Vs Monsters sample project
-- Designed and created by Jonathan and Biffy Beebe of Beebe Games exclusively for Ansca, Inc.
-- http://beebegamesonline.appspot.com/
-- (This is easiest to play on iPad or other large devices, but should work on all iOS and Android devices)
--
-- Version: 1.1
--
-- Sample code is MIT licensed, see http://developer.anscamobile.com/code/license
-- Copyright (C) 2010 ANSCA Inc. All Rights Reserved.
module(..., package.seeall)
-- Main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
local theTimer
local loadingImage
local showLoadingScreen = function()
loadingImage = display.newImageRect( "loading.png", 480, 320 )
loadingImage.x = 240; loadingImage.y = 160
local goToLevel = function()
director:changeScene( "level2" )
end
theTimer = timer.performWithDelay( 1000, goToLevel, 1 )
end
showLoadingScreen()
clean = function()
if theTimer then timer.cancel( theTimer ); end
if loadingImage then
--loadingImage:removeSelf()
display.remove( loadingImage )
loadingImage = nil
end
end
-- MUST return a display.newGroup()
return localGroup
end