-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.lua
155 lines (123 loc) · 5.76 KB
/
menu.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
mainMenu = {}
i = 1
function mainMenu:new()
local object = {}
object.instructions = {}
object.instructions1 = display.newImage("img/tutorial/screen-1.png", 0, 0)
table.insert(object.instructions, object.instructions1)
--object.instructions2 = {}
table.insert(object.instructions, display.newImage("img/tutorial/screen-2-1.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-2-2.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-2-3.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-2-4.png", 0, 0))
--table.insert(object.instructions, object.instructions2)
--object.instructions3 = {}
table.insert(object.instructions, display.newImage("img/tutorial/screen-3-1.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-3-2.png", 0, 0))
--table.insert(object.instructions, object.instructions3)
object.instructions4 = display.newImage("img/tutorial/screen-4.png", 0, 0)
table.insert(object.instructions, object.instructions4)
--object.instructions5 = {}
table.insert(object.instructions, display.newImage("img/tutorial/screen-5-1.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-5-2.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-5-3.png", 0, 0))
--table.insert(object.instructions, object.instructions5)
--object.instructions6 = {}
table.insert(object.instructions, display.newImage("img/tutorial/screen-6-1.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-6-2.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-6-3.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-6-4.png", 0, 0))
--table.insert(object.instructions, object.instructions6)
--object.instructions7 = {}
table.insert(object.instructions, display.newImage("img/tutorial/screen-7-1.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-7-2.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-7-3.png", 0, 0))
table.insert(object.instructions, display.newImage("img/tutorial/screen-7-4.png", 0, 0))
--table.insert(object.instructions, object.instructions7)
object.instructions8 = display.newImage("img/tutorial/screen-8.png", 0, 0)
table.insert(object.instructions, object.instructions8)
object.instructions9 = display.newImage("img/tutorial/screen-9.png", 0, 0)
table.insert(object.instructions, object.instructions9)
object.instructions10 = display.newImage("img/tutorial/screen-10.png", 0, 0)
table.insert(object.instructions, object.instructions10)
for i,v in ipairs(object.instructions) do
v.isVisible = false
end
object.background = display.newImage("img/title.png", 0, 0)
object.button1 = display.newImage("img/menu_tutorial.png", 50, 425)
object.button2 = display.newImage("img/menu_back.png", 0, 180)
object.button3 = display.newImage("img/menu_next.png", 878, 180)
object.playbutton = display.newImage("img/menu_play.png", 336, 425)
object.highscorebutton = display.newImage("img/menu_highscore.png", 622, 425)
object.button2.isVisible = false
object.button3.isVisible = false
object.help = false
object.play = false
setmetatable(object, {__index = mainMenu})
return object
end
--[[function mainMenu:setHelp(help)
if help then
print("one")
self.instructions.isVisible = false
self.background.isVisible = true
self.button1.isVisible = false
self.button2.isVisible = true
self.help = true
else
print("two")
self.instructions.isVisible = true
self.background.isVisible = false
self.button2.isVisible = false
self.button1.isVisible = true
self.help = false
end
end]]
function mainMenu:setHelp()
self.background.isVisible = false
self.button1.isVisible = false
self.button2.isVisible = true
self.button3.isVisible = true
self.playbutton.isVisible = false
self.highscorebutton.isVisible = false
self.instructions[1].isVisible = true
end
function mainMenu:Play()
self.instructions.isVisible = false
self.background.isVisible = false
self.button2.isVisible = false
self.button1.isVisible = false
self.highscorebutton.isVisible = false
self.playbutton.isVisible = false
self.help = false
Runtime:removeEventListener("touch", self.touch)
self.play = true
end
--[[function mainMenu.touch(event)
if event.phase == "began" then
if (event.x > display.contentWidth/4 and event.x < display.contentWidth*3/4
and event.y > display.contentHeight/4 and event.y < display.contentHeight*3/4) then
if mainMenu.help then
mainMenu:setHelp(false)
else
mainMenu:setHelp(true)
end
elseif (event.x > display.contentWidth*3/4 and event.y > display.contentHeight*3/4) then
mainMenu:Play()
end
end
end
function mainMenu.touch(event)
if event.phase == "began" then
if (event.x > display.contentWidth/4 and event.x < display.contentWidth*3/4
and event.y > display.contentHeight/4 and event.y < display.contentHeight*3/4) then
if self.help then
self:setHelp(false)
else
self:setHelp(true)
end
elseif (event.x > display.contentWidth*3/4 and event.y > display.contentHeight*3/4) then
self:Play()
end
end
end]]