-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.lua
More file actions
69 lines (51 loc) · 1.44 KB
/
menu.lua
File metadata and controls
69 lines (51 loc) · 1.44 KB
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
module (..., package.seeall)
local director = require ("director")
local ui = require("ui")
-- Hide status bar
display.setStatusBar(display.HiddenStatusBar)
local mainGroup = display.newGroup()
function playGame()
if _G.firstPlay then
director:changeScene("tutorial", "fade")
else
director:changeScene("level1", "fade")
end
end
function help()
director:changeScene("tutorial", "fade")
end
function loadHighScore()
director:changeScene("showhighscore", "fade")
end
function new()
local background = display.newImage("menubg.png", true)
background:scale(1.35, 1.35)
background.y = display.contentHeight/2
mainGroup:insert(background)
local playButton = ui.newButton {
default = "playoff.png",
over = "playon.png",
onPress = playGame
}
local highscoreButton = ui.newButton {
default = "highscore.png",
onPress = loadHighScore
}
local tutorialButton = ui.newButton {
default = "help.png",
onPress = help
}
--playButton:scale(0.9, 0.9)
playButton.x = (display.contentWidth/2) - 200
playButton.y = (display.contentHeight) - 150
highscoreButton:scale(0.9, 0.9)
highscoreButton.x = (display.contentWidth/2) + 50
highscoreButton.y = (display.contentHeight) - 150
tutorialButton:scale(0.9, 0.9)
tutorialButton.x = (display.contentWidth/2) + 240
tutorialButton.y = (display.contentHeight) - 150
mainGroup:insert(playButton)
mainGroup:insert(highscoreButton)
mainGroup:insert(tutorialButton)
return mainGroup
end