-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmenuScene.lua
55 lines (38 loc) · 1.07 KB
/
menuScene.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
module(..., package.seeall)
function new()
local localGroup = display.newGroup()
function changeScene(e)
if(e.phase == "ended") then
director:changeScene(e.target.scene, "moveFromRight");
end
end
function exitGame()
os.exit()
end
local background = display.newImage('background.png')
background.x = _w/2;
background.y = _h/2;
-- menu buttons
local playBtn = display.newImage('playBtn.png')
playBtn.x = _w/2
playBtn.y = _h/2 - 45
playBtn.scene = "selectLevelScene"
playBtn:addEventListener("touch",changeScene)
local helpBtn = display.newImage('helpBtn.png')
helpBtn.x = _w/2
helpBtn.y = _h/2 + 45
helpBtn.scene = "helpScene"
helpBtn:addEventListener("touch",changeScene)
local exitBtn = display.newImage('exitBtn.png')
exitBtn.x = _w - exitBtn.width/2
exitBtn.y = _h - exitBtn.height/2
exitBtn.scene = "exit"
exitBtn:addEventListener("touch",exitGame)
localGroup:insert(background)
localGroup:insert(playBtn)
localGroup:insert(helpBtn)
localGroup:insert(exitBtn)
clean = function ()
end
return localGroup
end