Skip to content

Commit

Permalink
arreglo cositas (falta)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoVinaccia committed Sep 27, 2024
1 parent 0d4fba7 commit 2a35c2b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions juegoAjedrez2.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ object reyNegro {

method recibirDanio() {
vida -= 20
game.say(self, "Mi vida es de ")
game.say(self, "Mi vida es de " + vida)
self.morir()
}

method morir() {
if(vida == 0) {
game.removeVisual(self)
}
}

method sumarPuntos(enemigo) {
Expand Down Expand Up @@ -72,12 +79,13 @@ class PEON {
reyNegro.recibirDanio()
game.removeVisual(self)
} else {
position = position.left(1)
position = position.left(1)
}
}

method recibirDanio() {
vida = 0.max(vida - 25)
self.morir()
}
method morir() {
if(vida == 0) {
Expand Down Expand Up @@ -267,7 +275,8 @@ object agregarEnemigo {
var numeroPieza = 0

method numeroRandom() {
numeroPieza = 0.randomUpTo(6)
numeroPieza = 1.randomUpTo(5)
numeroPieza = numeroPieza.round()
}

method aparecerPieza() {
Expand Down
2 changes: 1 addition & 1 deletion main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ program Ajedrez2 {
keyboard.s().onPressDo({reyNegro.moverAbajo()})
keyboard.space().onPressDo({reyNegro.disparar()})

game.onCollideDo(bala1, {peon1.recibirDanio()})
game.onCollideDo(bala1, {peon1=>peon1.recibirDanio()})

game.onTick(10000, "apareceEnemigo", {agregarEnemigo.aparecerPieza()})

Expand Down

0 comments on commit 2a35c2b

Please sign in to comment.