-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview04Store.lua
More file actions
268 lines (220 loc) Β· 8.47 KB
/
Copy pathview04Store.lua
File metadata and controls
268 lines (220 loc) Β· 8.47 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
-----------------------------------------------------------------------------------------
--
-- view2.lua
--
-----------------------------------------------------------------------------------------
local composer = require( "composer" )
local scene = composer.newScene()
local loadsave = require( "loadsave" )
local json = require( "json" )
function scene:create( event )
local sceneGroup = self.view
local loadedSettings = loadsave.loadTable( "settings.json" )
local loadedItems= loadsave.loadTable( "items.json" )
if loadedSettings.month == 5 then
if loadedSettings.month6_event == 0 then
loadedSettings.month6_event = loadedSettings.month6_event + 1
loadsave.saveTable(loadedSettings,"settings.json")
end
end
local background = display.newImage("μ΄λ―Έμ§/μμ /λ°°κ²½(κ°κ²©).png")
background.x, background.y = display.contentWidth*0.5, display.contentHeight*0.5
sceneGroup:insert(background)
local storeMusic = audio.loadStream( "μμ
/μμ .mp3" )
local function go_back(event)
if event.phase == "began" then
audio.pause(storeMusic)
composer.removeScene("view04Store")
composer.gotoScene("view01Map")
end
end
local exit = display.newImage("μ΄λ―Έμ§/곡ν΅/xλ²νΌ.png")
exit.x, exit.y = display.contentWidth*0.9207, display.contentHeight*0.0438
exit.anchorX, exit.anchorY = 0,0
sceneGroup:insert(exit)
exit:addEventListener("touch",go_back)
-- μ½μΈ μ°½ κ°μ²΄
local coin = display.newImage("μ΄λ―Έμ§/곡ν΅/μ½μΈνμμ°½.png")
sceneGroup:insert(coin)
coin.x, coin.y = display.contentWidth*0.1, display.contentHeight*0.08
loadedSettings.money=loadedSettings.money+1000
-- μ½μΈ κ°μ²΄, κΈμ¨μ²΄ λ° μΈμ΄λΈ νμΌμ λ΄κ²¨μ§ 보μ μ½μΈμ textμ λ΄μ
local money = display.newText("",display.contentWidth*0.16, display.contentHeight*0.079,"font/NanumSquare_acB.ttf")
money:setFillColor(0.964, 0.462, 0.411)
money.anchorX = 1
money.text = loadedSettings.money
money.size = 53
sceneGroup:insert(money)
-- μ§μ΄
local function popup(event)
if event.phase == "began" then
item = event.target.name
money = event.target.id
composer.setVariable("item", item)
composer.setVariable("money",money)
composer.removeScene("view04Store")
composer.gotoScene("view04Storeitem")
end
end
--1ν
local pencil = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ°ν.png")
pencil.x,pencil.y = display.contentWidth*0.1117, display.contentHeight*0.241
pencil.anchorX,pencil.anchorY = 0,0
pencil.name = "μ°ν"
pencil.id = 10
sceneGroup:insert(pencil)
pencil:addEventListener("touch",popup)
local dog_rice = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ¬λ£.png")
dog_rice.x,dog_rice.y = display.contentWidth*0.2615, display.contentHeight*0.241
dog_rice.anchorX,dog_rice.anchorY = 0,0
dog_rice.name = "μ¬λ£"
dog_rice.id = 16
sceneGroup:insert(dog_rice)
dog_rice:addEventListener("touch",popup)
local toy = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/λΈλ‘.png")
toy.x,toy.y = display.contentWidth*0.3948, display.contentHeight*0.241
toy.anchorX,toy.anchorY = 0,0
toy.id = 15
sceneGroup:insert(toy)
toy.name = "λΈλ‘"
toy:addEventListener("touch",popup)
local duck = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ€λ¦¬.png")
duck.x,duck.y = display.contentWidth*0.5427, display.contentHeight*0.249
duck.anchorX,duck.anchorY = 0,0
sceneGroup:insert(duck)
duck.name = "μ€λ¦¬"
duck.id = 14
duck:addEventListener("touch",popup)
local heart = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μμλ΄.png")
heart.x,heart.y = display.contentWidth*0.6807, display.contentHeight*0.24
heart.anchorX,heart.anchorY = 0,0
sceneGroup:insert(heart)
heart.name = "μμλ΄"
heart.id = 18
heart:addEventListener("touch",popup)
local pie = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/νμ΄.png")
pie.x,pie.y = display.contentWidth*0.8195, display.contentHeight*0.249
pie.anchorX,pie.anchorY = 0,0
sceneGroup:insert(pie)
pie.name = "νμ΄"
pie.id = 20
pie:addEventListener("touch",popup)
-- 2ν
local kit = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ€νμΈνΈ.png")
kit.x,kit.y = display.contentWidth*0.1788, display.contentHeight*0.5114
kit.anchorX,kit.anchorY = 0,0
sceneGroup:insert(kit)
kit.name = "μ€νμΈνΈ"
kit.id = 25
kit:addEventListener("touch",popup)
local plant = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/νλΆ.png")
plant.x,plant.y = display.contentWidth*0.3393, display.contentHeight*0.463
plant.anchorX,plant.anchorY = 0,0
sceneGroup:insert(plant)
plant.name = "νλΆ"
plant.id = 25
plant:addEventListener("touch",popup)
local tiger = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/νΈλμ΄.png")
tiger.x,tiger.y = display.contentWidth*0.475, display.contentHeight*0.48
tiger.anchorX,tiger.anchorY = 0,0
sceneGroup:insert(tiger)
tiger.name = "νΈλμ΄"
tiger.id = 25
tiger:addEventListener("touch",popup)
local purfume = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/ν₯μ.png")
purfume.x,purfume.y = display.contentWidth*0.6167, display.contentHeight*0.4736
purfume.anchorX,purfume.anchorY = 0,0
sceneGroup:insert(purfume)
purfume.name = "ν₯μ"
purfume.id = 25
purfume:addEventListener("touch",popup)
local speaker = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ€νΌμ»€.png")
speaker.x,speaker.y = display.contentWidth*0.7489, display.contentHeight*0.4901
speaker.anchorX,speaker.anchorY = 0,0
sceneGroup:insert(speaker)
speaker.name = "μ€νΌμ»€"
speaker.id = 25
speaker:addEventListener("touch",popup)
--3ν
local pin = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/머리ν.png")
pin.x,pin.y = display.contentWidth*0.1117, display.contentHeight*0.76
pin.anchorX,pin.anchorY = 0,0
sceneGroup:insert(pin)
pin.name = "머리ν"
pin.id = 10
pin:addEventListener("touch",popup)
local headset = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/ν€λμ
.png")
headset.x,headset.y = display.contentWidth*0.2615, display.contentHeight*0.712
headset.anchorX,headset.anchorY = 0,0
sceneGroup:insert(headset)
headset.name = "ν€λμ
"
headset.id = 25
headset:addEventListener("touch",popup)
local hero = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/λ§ν .png")
hero.x,hero.y = display.contentWidth*0.3948, display.contentHeight*0.74
hero.anchorX,hero.anchorY = 0,0
sceneGroup:insert(hero)
hero.name = "λ§ν "
hero.id = 15
hero:addEventListener("touch",popup)
local galsses = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μκ²½λ¦μ΄.png")
galsses.x,galsses.y = display.contentWidth*0.6807, display.contentHeight*0.725
galsses.anchorX,galsses.anchorY = 0,0
sceneGroup:insert(galsses)
galsses.name = "μκ²½λ¦μ΄"
galsses.id = 25
galsses:addEventListener("touch",popup)
local mint = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/λ―Όμ΄.png")
mint.x,mint.y = display.contentWidth*0.543, display.contentHeight*0.73
mint.anchorX,mint.anchorY = 0,0
sceneGroup:insert(mint)
mint.name = "λ―Όμ΄"
mint.id = 25
mint:addEventListener("touch",popup)
local frame = display.newImage("μ΄λ―Έμ§/μμ /μμ΄ν
/μ‘μ.png")
frame.x,frame.y = display.contentWidth*0.8195, display.contentHeight*0.73
frame.anchorX,frame.anchorY = 0,0
sceneGroup:insert(frame)
frame.name = "μ‘μ"
frame.id = 20
frame:addEventListener("touch",popup)
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
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