generated from wollok/empty-game
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a435a51
commit 333e932
Showing
11 changed files
with
300 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import wollok.game.* | ||
import direcciones.* | ||
|
||
class Guardia { | ||
var property position = game.at(2,3) | ||
var ladoAMover = derecha | ||
|
||
method image(){ | ||
return "guardia." + ladoAMover.toString() + ".png" | ||
} | ||
|
||
|
||
method caminar(){ | ||
const proxima = ladoAMover.siguiente(position) | ||
position = proxima | ||
self.cambiarLadoSiCorresponde() | ||
} | ||
|
||
method cambiarLadoSiCorresponde(){ | ||
if (position.x() == game.width() -1 or position.x() == 0){ | ||
ladoAMover = ladoAMover.opuesto() | ||
} | ||
} | ||
|
||
method esSolidoPara(personaje){ | ||
return false | ||
} | ||
|
||
method colisionarCon(personaje){ | ||
game.say(self, "te atrapé!") | ||
personaje.volverAlPrincipio() | ||
} | ||
|
||
} | ||
|
||
class CaminoInvalido{ | ||
const property position | ||
const posicionEntrada = tunel.position() | ||
|
||
method image(){ | ||
return "nada.png" | ||
} | ||
|
||
method colisionarCon(personaje){ | ||
personaje.position(self.arribaDeLaEntrada()) | ||
} | ||
|
||
method arribaDeLaEntrada(){ | ||
return arriba.siguiente(posicionEntrada) | ||
} | ||
|
||
method esSolidoPara(personaje){ | ||
return false | ||
} | ||
} | ||
|
||
|
||
|
||
object tunel{ | ||
var property position = game.at(0,0) | ||
|
||
method image(){ | ||
return "tunel.png" | ||
|
||
} | ||
|
||
method esSolidoPara(personaje){ | ||
return personaje.puedePasar(self) | ||
} | ||
|
||
method colisionarCon(personaje){ | ||
|
||
} | ||
|
||
} | ||
|
||
|
||
class Pared{ | ||
const property position | ||
|
||
method image(){ | ||
return "pared.png" | ||
} | ||
|
||
method esSolidoPara(personaje){ | ||
return true | ||
} | ||
} | ||
|
||
class AtrapaMagos{ | ||
const property position | ||
|
||
method image(){ | ||
return "nada.png" | ||
} | ||
|
||
method colisionarCon(personaje){ | ||
game.say(personaje, "Me pueden ver!") | ||
personaje.volverAlPrincipio() | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import wollok.game.* | ||
import enemigos.* | ||
import personajes.* | ||
import objetosUtiles.* | ||
|
||
object nivelx { | ||
|
||
var celdas = | ||
[[i, i, i, i, i, i, i, i, i, i, i, i, i, i, i, p, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[i, i, i, i, i, i, i, i, i, i, i, i, i, i, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[i, i, i, i, i, i, i, i, i, _, _, _, i, i, _, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, i, i, i, i, i, i, _, i, _, _, i, _, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, i, i, i, i, i, i, _, _, i, _, _, _, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, i, i, i, i, i, i, i, _, i, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, i, i, i, i, i, i, i, _, _, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, i, _, _, _, _, i, i, i, _, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, _, _, i, i, _, _, _, i, _, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, i, i, i, i, i, i, _, i, _, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, i, i, i, i, i, i, _, _, _, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, i, i, i, i, i, i, i, i, i, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, i, i, i, i, i, i, i, i, i, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, _, _, i, _, _, _, i, i, i, i, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[i, i, i, _, _, _, i, _, i, i, i, i, i, i, i, p, a, a, a, a, a, a, a, a, a, a, a, a, a, a], | ||
[p, p, p, p, p, p, p, t, p, p, p, p, p, p, p, p, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, o, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _] | ||
].reverse() | ||
|
||
|
||
var guardiasYOculto= | ||
[[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, o, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, g, _, _, _, _, g, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, g, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _], | ||
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _] | ||
].reverse() | ||
|
||
|
||
method generar(){ | ||
(0..game.width() -1).forEach({x=> | ||
(0..game.height() -1).forEach()({y=> | ||
self.generarCelda(x,y) | ||
self.generarGuardiasYOculto(x,y) | ||
}) | ||
}) | ||
} | ||
|
||
method generarCelda(x,y){ | ||
const celda = celdas.get(y).get(x) | ||
celda.generar(game.at(x,y)) | ||
} | ||
|
||
method generarGuardiasYOculto(x,y){ | ||
const celda = celdas.get(y).get(x) | ||
celda.generar(game.at(x,y)) | ||
} | ||
|
||
} | ||
|
||
object _{ | ||
method generar(position){} | ||
} | ||
|
||
object i{ | ||
method generar(position){ | ||
game.addVisual(new CaminoInvalido(position = position)) | ||
} | ||
} | ||
|
||
object t{ | ||
method generar(position){ | ||
game.addVisual(tunel) | ||
tunel.position(position) | ||
} | ||
} | ||
|
||
object o{ | ||
method generar(position){ | ||
const oculto = new Oculto(position = position) | ||
game.addVisual(oculto) | ||
objetosUsables.agregarObjeto(oculto) | ||
} | ||
} | ||
|
||
object p{ | ||
method generar(position){ | ||
game.addVisual(new Pared(position = position)) | ||
} | ||
} | ||
|
||
object g{ | ||
method generar(position){ | ||
game.addVisual(new Guardia(position = position)) | ||
} | ||
} | ||
|
||
object a{ | ||
method generar(position){ | ||
game.addVisual(new AtrapaMagos(position = position)) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.