Skip to content

Commit

Permalink
cambios de celdas
Browse files Browse the repository at this point in the history
  • Loading branch information
Malena-Sciutto committed Oct 6, 2023
1 parent 333e932 commit e233e40
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 36 deletions.
2 changes: 2 additions & 0 deletions src/enemigos.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class Pared{
method esSolidoPara(personaje){
return true
}

method colisionarCon(personaje){}
}

class AtrapaMagos{
Expand Down
10 changes: 5 additions & 5 deletions src/juego.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import personajes.*
import direcciones.*
import objetosUtiles.*
import enemigos.*
import nivelx.*

program juego {
game.title("Harry Potter: Escape de Azkaban")
Expand All @@ -11,11 +12,11 @@ program juego {
game.height(18)
game.boardGround("background2.png")

game.addVisual(oculto)
game.addVisual(harry)
game.addVisual(sirius)
game.onTick(1000, "caminataGuardias", {guardias.caminar()})
//game.addVisual(harry)
//game.addVisual(sirius)
//game.onTick(1000, "caminataGuardias", {guardias.caminar()})

nivelx.generar()
keyboard.up().onPressDo({ harry.mover(arriba) })
keyboard.down().onPressDo({ harry.mover(abajo) })
keyboard.left().onPressDo({ harry.mover(izquierda) })
Expand All @@ -34,6 +35,5 @@ program juego {
keyboard.enter().onPressDo({ harry.usarObjeto() })



game.start()
}
70 changes: 39 additions & 31 deletions src/nivelx.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@ 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, _, _, _, _, _, _, _, _, _, _, _, _, _, _],
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
const 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, g], [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, g], [a], [a]],
[[i], [i], [i], [i], [i], [i], [i], [i], [i], [_], [_], [i], [_], [_], [_], [p], [a], [a], [a], [a, g], [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, g], [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, g], [a], [a], [a], [a], [a], [a]],
[[i], [i], [i], [i], [_], [_], [_], [_], [i], [i], [i], [_], [i], [i], [i], [p], [a, o], [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, g], [a], [a], [a, g], [a], [a], [a], [a], [a, g], [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, g], [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, g], [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, g], [a], [a], [a], [a], [a, g], [a], [a], [a], [a], [a]],
[[i], [i], [i], [_], [_], [_], [i], [_], [i], [i], [i], [i], [i], [i], [i], [p], [a], [a], [a], [a], [a, g], [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], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_]],
[[h], [s], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_], [_]]
].reverse()


var guardiasYOculto=
[[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _],
/* const guardiasYOculto=
[[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, p, _, _, _, _, _, _, _, _, _, _, _, _, _, _],
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _],
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _, _, _, _, _, _, _],
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, g, _, _],
Expand All @@ -48,24 +48,19 @@ object nivelx {
[_, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _]
].reverse()
*/


method generar(){
(0..game.width() -1).forEach({x=>
(0..game.height() -1).forEach()({y=>
self.generarCelda(x,y)
self.generarGuardiasYOculto(x,y)
})
(0..game.height() -1).forEach({y=>
self.generarCelda(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))
celda.forEach({objeto=> objeto.generar(game.at(x,y))})
}

}
Expand Down Expand Up @@ -113,4 +108,17 @@ object a{
}
}

object h{
method generar(position){
harry.position(position)
game.addVisual(harry)
}
}

object s{
method generar(position){
sirius.position(position)
game.addVisual(sirius)
}
}

0 comments on commit e233e40

Please sign in to comment.