-
Notifications
You must be signed in to change notification settings - Fork 0
/
pepita.wlk
49 lines (36 loc) · 785 Bytes
/
pepita.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
import extras.*
import wollok.game.*
object pepita {
var property energia = 100
var property position = game.origin()
method image() {
return if (self.estaEnElNido()) {
"pepita-grande.png"
}else if (self.esAtrapada()) {
"pepita-silvestre.png"
} else "pepita.png"
}
method esAtrapada() {
return self.position() == silvestre.position()
}
method come(comida) {
energia = energia + comida.energiaQueOtorga()
//algo
}
method vola(kms) {
energia = energia - kms * 9
}
method irA(nuevaPosicion) {
self.vola(position.distance(nuevaPosicion))
position = nuevaPosicion
}
method estaCansada() {
return energia <= 0
}
method estaEnElNido() {
return position == nido.position()
}
method estaEnElSuelo() {
return position.y() == 0
}
}