Skip to content

Commit

Permalink
decodificador para los bloques
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyleca committed Nov 7, 2024
1 parent ff80273 commit 65e60d6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 44 deletions.
14 changes: 6 additions & 8 deletions muros.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -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)})
})
}

Expand Down
88 changes: 52 additions & 36 deletions niveles.wlk
Original file line number Diff line number Diff line change
@@ -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,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],
[b,n,b,n,b,n,b,n,n,b,n,b,n,b,n,b,n,b],
[b,n,b,n,b,n,b,b,b,n,n,b,n,b,n,b,n,b],
[b,n,b,n,b,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) {}
}

0 comments on commit 65e60d6

Please sign in to comment.