diff --git a/muros.wlk b/muros.wlk index 311d776..3ff140d 100644 --- a/muros.wlk +++ b/muros.wlk @@ -33,22 +33,20 @@ object visualSuperior{ } object escenario{ - const listaPosiciones = [] - const listafrutas = [] - const listaBloques = [] + const property listaPosiciones = [] + const property listafrutas = [] + const property listaBloques = [] var property nivel = 0 method generarEscenario(){ (16 .. 0).forEach({y => const listaAux = niveles.entregarFila(17-y, nivel) (0..17).forEach({x => const aux = listaAux.get(x) - if(aux == 1){listaPosiciones.add(game.at(x,y)) - new Bloque().ubicarYDibujar(x,y)} - }) - }) + aux.decodificar(x, y)}) + }) } method generarBloquesSuperiores(){//para crear la ilusion de que el jugador está detrás del bloque (16 .. 0).forEach({y => const listaAux = niveles.entregarFila(17-y, nivel) - (0..17).forEach({x => const aux = listaAux.get(x) if(aux == 1){new BloqueSuperior().ubicarYDibujar(x, y)}}) + (0..17).forEach({x => const aux = listaAux.get(x) aux.decodificarSuperior(x, y)}) }) } diff --git a/niveles.wlk b/niveles.wlk index 8c1bde8..c456c57 100644 --- a/niveles.wlk +++ b/niveles.wlk @@ -1,41 +1,57 @@ +import miscelaneos.* +import muros.* + object niveles{ - const nivel1 = [[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1], - [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], - [1,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,0,1], - [1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1], - [1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1], - [1,0,1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1], - [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], - [1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,1], - [1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1], - [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], - [1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1], - [1,0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n,n,n,n,n,b,n,n,b,n,b,n,b], + [b,n,b,n,b,b,b,b,b,b,n,n,b,b,n,b,n,b], + [b,n,b,n,n,n,n,n,n,n,n,b,n,n,n,b,n,b], + [b,n,n,b,b,b,b,b,b,b,b,n,n,b,b,n,n,b], + [b,n,n,n,n,n,n,n,n,n,n,b,b,n,n,n,n,b], + [b,n,n,b,b,b,b,b,b,b,b,n,n,n,n,n,n,b], + [b,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,b], + [b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b]] method entregarFila(fila, nivel) = if(nivel == 1) nivel1.get(fila) else nivel2.get(fila) +} + +object b { + method decodificar(x,y) + { + escenario.listaPosiciones().add(game.at(x,y)) + new Bloque().ubicarYDibujar(x,y) + } + method decodificarSuperior(x,y) = new BloqueSuperior().ubicarYDibujar(x, y) +} + +object n { + method decodificar(x,y) {} } \ No newline at end of file