-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathending_13.lua
More file actions
147 lines (121 loc) · 3.82 KB
/
ending_13.lua
File metadata and controls
147 lines (121 loc) · 3.82 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
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
-----------------------------------------------------------------------------------------
--
-- view2.lua
--
-----------------------------------------------------------------------------------------
local composer = require( "composer" )
local scene = composer.newScene()
function scene:create( event )
local sceneGroup = self.view
local bookSound = audio.loadSound("music/book.mp3")
local background = display.newImage("image/ending_13.png")
background.x = display.contentCenterX
background.y = display.contentCenterY
sceneGroup:insert(background)
local diary1 = display.newImage("image/diary1.png")
diary1.x = display.contentCenterX
diary1.y = display.contentCenterY
sceneGroup:insert(diary1)
local diary2 = display.newImage("image/diary2.png")
diary2.x = display.contentCenterX
diary2.y = display.contentCenterY
sceneGroup:insert(diary2)
local diary3 = display.newImage("image/diary3.png")
diary3.x = display.contentCenterX
diary3.y = display.contentCenterY
sceneGroup:insert(diary3)
local diary4 = display.newImage("image/diary4.png")
diary4.x = display.contentCenterX
diary4.y = display.contentCenterY
sceneGroup:insert(diary4)
local diary5 = display.newImage("image/diary5.png")
diary5.x = display.contentCenterX
diary5.y = display.contentCenterY
sceneGroup:insert(diary5)
local diary6 = display.newImage("image/diary6.png")
diary6.x = display.contentCenterX
diary6.y = display.contentCenterY
sceneGroup:insert(diary6)
local next = display.newImage("image/NextButton.png")
next.x = display.contentCenterX + 523
next.y = display.contentCenterY + 384
sceneGroup:insert(next)
local options = {
effect = "fade",
time = 400
}
diary2.isVisible = false
diary3.isVisible = false
diary4.isVisible = false
diary5.isVisible = false
diary6.isVisible = false
local k = 2
local function Next(evnet)
if k == 2 then
audio.play(bookSound)
diary1.isVisible = false
diary2.isVisible = true
elseif k == 3 then
audio.play(bookSound)
diary2.isVisible = false
diary3.isVisible = true
elseif k == 4 then
audio.play(bookSound)
diary3.isVisible = false
diary4.isVisible = true
elseif k == 5 then
audio.play(bookSound)
diary4.isVisible = false
diary5.isVisible = true
elseif k == 6 then
audio.play(bookSound)
diary5.isVisible = false
diary6.isVisible = true
end
k = k + 1
if k == 8 then
composer.gotoScene("ending_14", options)
end
end
next:addEventListener("tap",Next)
end
function scene:show( event )
local sceneGroup = self.view
local phase = event.phase
if phase == "will" then
-- Called when the scene is still off screen and is about to move on screen
elseif phase == "did" then
-- Called when the scene is now on screen
--
-- INSERT code here to make the scene come alive
-- e.g. start timers, begin animation, play audio, etc.
end
end
function scene:hide( event )
local sceneGroup = self.view
local phase = event.phase
if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
composer.removeScene("view2")
end
end
function scene:destroy( event )
local sceneGroup = self.view
-- Called prior to the removal of scene's "view" (sceneGroup)
--
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
end
---------------------------------------------------------------------------------
-- Listener setup
scene:addEventListener( "create", scene )
scene:addEventListener( "show", scene )
scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )
-----------------------------------------------------------------------------------------
return scene