This repository has been archived by the owner on Dec 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene-menu.lua
146 lines (109 loc) · 3.86 KB
/
scene-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
local composer = require( "composer" )
local scene = composer.newScene()
local backgroup = display.newGroup()
local foregroup = display.newGroup()
lvl = {
adventure = 2,
goal = {[0]={
-- monster's index | buble
name = "1",
count = 10}
--, [1]={ name = "3", count = 15}
},
condition = {
-- timer | steps
name = "steps",
count = 10
},
field = {
[0] = {[0]=10,[1]=0,[2]=0,[3]=0,[4]=30},
[1] = {[0]=20,[1]=0,[2]=0,[3]=40,[4]=0},
[2] = {[0]=0,[1]=10,[2]=0,[3]=30,[4]=0},
[3] = {[0]=0,[1]=0,[2]=0,[3]=0,[4]=0},
[4] = {[0]=0,[1]=10,[2]=0,[3]=0,[4]=30},
[5] = {[0]=20,[1]=0,[2]=0,[3]=40,[4]=0},
[6] = {[0]=10,[1]=0,[2]=0,[3]=30,[4]=0},
},
special = {
[0] = {[0]=0,[1]=1,[2]=0,[3]=1,[4]=0},
[1] = {[0]=0,[1]=1,[2]=0,[3]=1,[4]=0},
[2] = {[0]=0,[1]=1,[2]=0,[3]=1,[4]=0},
[3] = {[0]=0,[1]=1,[2]=1,[3]=1,[4]=0},
[4] = {[0]=0,[1]=0,[2]=1,[3]=0,[4]=0},
[5] = {[0]=0,[1]=0,[2]=1,[3]=0,[4]=0},
[6] = {[0]=0,[1]=0,[2]=1,[3]=0,[4]=0},
},
border = {
[0] = {[0]="",[1]="",[2]="",[3]="",[4]=""},
[1] = {[0]="",[1]="",[2]="",[3]="",[4]=""},
[2] = {[0]="",[1]="bottom",[2]="bottom",[3]="bottom",[4]=""},
[3] = {[0]="",[1]="bottom",[2]="bottom",[3]="bottom",[4]=""},
[4] = {[0]="",[1]="",[2]="",[3]="",[4]=""},
[5] = {[0]="",[1]="",[2]="",[3]="",[4]=""},
[6] = {[0]="",[1]="",[2]="",[3]="",[4]=""},
}
}
function scene:create( event )
local sceneGroup = self.view
local function next_frame( btn )
return composer.gotoScene(btn.next_frame, btn.params)
end
local function button_unpressed( btn )
transition.to(btn, {y=btn.y-5, onComplete=next_frame, time=100})
transition.to(btn.text, {y=btn.text.y-5, time=100})
end
local function button_pressed( event )
btn = event.target
transition.to(btn, {y=btn.y+5, onComplete=button_unpressed, time=100})
transition.to(btn.text, {y=btn.text.y+5, time=100})
end
backgroup.x = display.contentCenterX
backgroup.y = display.contentCenterY
foregroup.x = display.contentCenterX
foregroup.y = display.contentCenterY
foregroup.anchorX = 0.5
foregroup.anchorY = 0.5
local bg = display.newImageRect(backgroup, "assets/backgrounds/2.png", 720, 1280)
local button_play = {}
button_play.image = display.newImageRect(foregroup, "assets/gui/simple/button.png",400, 166 )
button_play.image.text = display.newText(foregroup, "Игра", 0, 0, native.systemFont, 85)
button_play.image.next_frame ="scene-game"
button_play.image.params = {effect="slideLeft", params = lvl}
local button_progress = {}
button_progress.image = display.newImageRect(foregroup, "assets/gui/simple/button.png",400, 166 )
button_progress.image.text = display.newText(foregroup, "Улучшения", 0, 0,"assets/fonts/12243.otf", 70)
button_progress.image.next_frame = "scene-exit"
button_progress.image.params = {effect="slideLeft", params={[1] = 0,
[2] = 0,
[3] = 0,
[4] = 0}}
local button_challenge = {}
button_challenge.image = display.newImageRect(foregroup, "assets/gui/simple/button.png",400, 166 )
button_challenge.image.text = display.newText(foregroup, "Турнир", 0, 0,"assets/fonts/12243.otf", 70)
button_challenge.image.next_frame = "scene-progress"
button_play.image.y = -200
button_play.image.text.y = -200
--button_progress.image.y = 100
--button_progress.image.text.y = 100
button_challenge.image.y = 200
button_challenge.image.text.y = 200
button_play.image:addEventListener("tap", button_pressed)
button_progress.image:addEventListener("tap", button_pressed)
button_challenge.image:addEventListener("tap", button_pressed)
sceneGroup:insert(backgroup)
sceneGroup:insert(foregroup)
end
function scene:show( event )
print(lvl.goal[0].count)
end
function scene:hide( event )
-- body
end
function scene:destroy( event )
-- body
end
scene:addEventListener("create", scene)
scene:addEventListener("show", scene)
scene:addEventListener("hide", scene)
scene:addEventListener("destroy", scene)
return scene