-
Notifications
You must be signed in to change notification settings - Fork 0
/
menuYTeclado.wlk
204 lines (166 loc) · 4.21 KB
/
menuYTeclado.wlk
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
import stickyBlocks.*
import levels.*
//*==========================| MENU Inicial |==========================
object menu{
method iniciar(){
juegoStickyBlock.clear()
//Visuales
self.drawMenu()
//Teclado
configTeclado.menuOn()
}
method drawMenu(){
new OnlyVisual(image = "Logo.png", position = game.at(8,7)).iniciar()
levelMenu.iniciar()
}
}
object levelMenu{
const property position = game.at(7,4)
var levelMenuIsOpen = false
var image = "CloseMenu.png"
method image() = image
method iniciar(){
game.addVisual(self)
configTeclado.menuOn()
levelMenuIsOpen = false
image = "CloseMenu.png"
}
method toggle() = if(levelMenuIsOpen) self.close() else self.open()
method close(){
image = "CloseMenu.png"
configTeclado.menuOn()
levelMenuIsOpen = false
}
method open(){
image = "OpenMenu.png"
configTeclado.levelMenuOn()
levelMenuIsOpen = true
}
}
class OnlyVisual{
method iniciar(){
game.addVisual(self)
}
var property image
const property position
}
//*==========================| Config Teclado |==========================
object configTeclado{
var teclado = tecladoJuego
method iniciar(){
//* GAME ON:
//Movimientos:
keyboard.up().onPressDo({teclado.up()})
keyboard.down().onPressDo({teclado.down()})
keyboard.left().onPressDo({teclado.left()})
keyboard.right().onPressDo({teclado.right()})
//unDo:
keyboard.control().onPressDo({teclado.control()})
//Menu en nivel:
keyboard.m().onPressDo({teclado.m()})
keyboard.r().onPressDo({teclado.r()})
//* MENU ON:
keyboard.p().onPressDo({teclado.p()})
keyboard.l().onPressDo({teclado.l()})
//* LEVEL MENU ON:
keyboard.num1().onPressDo({teclado.num1()})
keyboard.num2().onPressDo({teclado.num2()})
keyboard.num3().onPressDo({teclado.num3()})
keyboard.num4().onPressDo({teclado.num4()})
keyboard.num5().onPressDo({teclado.num5()})
keyboard.num6().onPressDo({teclado.num6()})
keyboard.num7().onPressDo({teclado.num7()})
keyboard.num8().onPressDo({teclado.num8()})
keyboard.num9().onPressDo({teclado.num9()})
}
method gameOn(){
teclado = tecladoJuego
}
method menuOn(){
teclado = tecladoMenu
}
method levelMenuOn(){
teclado = tecladoSelectorNivel
}
}
class TecladoBase{
method up(){}
method down(){}
method left(){}
method right(){}
method control(){}
method m(){}
method r(){}
method p(){}
method l(){}
method num1(){}
method num2(){}
method num3(){}
method num4(){}
method num5(){}
method num6(){}
method num7(){}
method num8(){}
method num9(){}
}
object tecladoJuego inherits TecladoBase{
override method up(){
cuerpo.moverCuerpo(arriba)
}
override method down(){
cuerpo.moverCuerpo(abajo)
}
override method left(){
cuerpo.moverCuerpo(izquierda)
}
override method right(){
cuerpo.moverCuerpo(derecha)
}
override method control(){
juegoStickyBlock.unDo()
}
override method m(){
menu.iniciar()
}
override method r(){
juegoStickyBlock.reset()
}
}
class TecladoMenu inherits TecladoBase{
override method p(){
juegoStickyBlock.nivelActual().iniciar()
}
override method l(){
levelMenu.toggle()
}
}
const tecladoMenu = new TecladoMenu()
object tecladoSelectorNivel inherits TecladoMenu{
override method num1(){
nivel1.iniciar()
}
override method num2(){
nivel2.iniciar()
}
override method num3(){
nivel3.iniciar()
}
override method num4(){
nivel4.iniciar()
}
override method num5(){
nivel5.iniciar()
}
override method num6(){
nivel6.iniciar()
}
override method num7(){
nivel7.iniciar()
}
override method num8(){
nivel8.iniciar()
}
override method num9(){
nivel9.iniciar()
}
}