-
Notifications
You must be signed in to change notification settings - Fork 2
/
selectLevelScene.lua
60 lines (44 loc) · 1.53 KB
/
selectLevelScene.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
module(..., package.seeall)
function new()
-- we store everything inside this group at the end
local localGroup = display.newGroup()
-- change scene function
function changeScene(e)
if(e.phase == "ended") then
director:changeScene(e.target.scene, "moveFromLeft");
end
end
local background = display.newImage('selectLevelBg.png')
background.x = _w/2;
background.y = _h/2;
-- menu buttons
local backBtn = display.newImage('backBtn.png')
backBtn.x = backBtn.width/2
backBtn.y = backBtn.height/2
backBtn.scene = "menuScene"
backBtn:addEventListener("touch",changeScene)
local level1Label = display.newText("level1#",0,0,native.systemFontBold,23)
level1Label:setReferencePoint(display.CenterReferencePoint)
level1Label:setTextColor(234,34,34,255)
level1Label.x = _w/2
level1Label.y = _h/2 - 30
level1Label.scene = "level1Scene"
level1Label:addEventListener("touch",changeScene)
local level2Label = display.newText("level2#",0,0,native.systemFontBold,23)
level2Label:setReferencePoint(display.CenterReferencePoint)
level2Label:setTextColor(234,34,34,255)
level2Label.x = _w/2
level2Label.y = _h/2 + 30
level2Label.scene = "level1Scene"
level1Label:addEventListener("touch",changeScene)
--- insert everything into the localGroup
localGroup:insert(background)
localGroup:insert(backBtn)
localGroup:insert(level1Label)
localGroup:insert(level2Label)
-- clean everything up
clean = function ()
end
-- do not remove lest the sky shalt fall upon thine head
return localGroup
end