Skip to content

Commit

Permalink
ahora no requiere colisiones para terminar el
Browse files Browse the repository at this point in the history
juego
  • Loading branch information
NahuelMarek committed Oct 16, 2024
1 parent 2ba8c95 commit 1781cab
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 37 deletions.
21 changes: 0 additions & 21 deletions casa.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,8 @@ object casa {
}
}

class HitboxCasa {
const position
method position() = position
method queSoy() = "casa"
}

const hitbox1 = new HitboxCasa(position = game.at(0, 0))
const hitbox2 = new HitboxCasa(position = game.at(0, 1))
const hitbox3 = new HitboxCasa(position = game.at(0, 2))
const hitbox4 = new HitboxCasa(position = game.at(0, 3))
const hitbox5 = new HitboxCasa(position = game.at(0, 4))

object pantallaFinal {
method position()=game.at(0,0)
method image()= "fin.jpg"
}
/* game.addVisual(hitbox1)
game.addVisual(hitbox2)
game.addVisual(hitbox3)
game.addVisual(hitbox4)
game.addVisual(hitbox5)
game.onCollideDo(hitbox1, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox2, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox3, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox4, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox5, {elemento => elemento.daniarCasa()}) */
2 changes: 1 addition & 1 deletion cursor.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object cursor {
}

method moverseDerecha() = if (self.position().x()<14) position.goRight(1)
method moverseIzquierda() = if (self.position().x()>0) position.goLeft(1)
method moverseIzquierda() = if (self.position().x()>1) position.goLeft(1)
method moverseArriba() = if (self.position().y()<4) position.goUp(1)
method moverseAbajo() = if (self.position().y()>0) position.goDown(1)

Expand Down
11 changes: 1 addition & 10 deletions main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,7 @@ program cursorGame {
cursor.accion()
menu.iniciarTienda()

game.addVisual(hitbox1)
game.addVisual(hitbox2)
game.addVisual(hitbox3)
game.addVisual(hitbox4)
game.addVisual(hitbox5)
game.onCollideDo(hitbox1, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox2, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox3, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox4, {elemento => elemento.daniarCasa()})
game.onCollideDo(hitbox5, {elemento => elemento.daniarCasa()})


// metodos generador de enemigos
game.onTick(3000, "generar nuevo Enemigo", {generadorDeEnemigos.sumarEnemigo()
Expand Down
8 changes: 3 additions & 5 deletions zombie.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ class SlimeBasico inherits Colision{

method estaMuerto(){
if (vida <= 0 || position.x() < 0){
casa.recibirDanio()
casa.terminarJuego()

game.removeVisual(self)
generadorDeEnemigos.eliminarEnemigo(self)
}
return vida <= 0 || position.x() <= 0

}

method daniarCasa(){
casa.recibirDanio()
casa.terminarJuego()
}
}

//const jose = new SlimeBasico(position= new MutablePosition(x=10, y=0.randomUpTo(5).truncate(0)))
Expand Down

0 comments on commit 1781cab

Please sign in to comment.