Skip to content

Commit

Permalink
Casi terminado
Browse files Browse the repository at this point in the history
  • Loading branch information
Juanter134 committed Nov 6, 2024
1 parent a09a03c commit ad2b6f8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
30 changes: 22 additions & 8 deletions entorno.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ import jefe.*
object entorno {
method limpiarEntorno() {
game.allVisuals().forEach({visible => game.removeVisual(visible)})
administradorVidas.mostrarVidas()
}

method volverAlHub() {
const jefesHub = [jefeDePrueba, jefeGato]

game.allVisuals().forEach({visible => game.removeVisual(visible)})
administradorVidas.mostrarVidas()

game.addVisual(morcilla)

jefesHub.forEach({jefe => jefe.posicionPrevia()})

// Comprobar si se derrotaron 2, que aparezca el malo malísimo
}
}

Expand Down Expand Up @@ -61,12 +75,15 @@ class BossFight {
turnoMorcilla = false
game.removeVisual(cartelAtaque)

const duracionCinematica = 2000
const duracionCinematica = 1500
morcilla.atacar()
jefe.disminuirVida()

if(jefe.derrotado())
self.finalizarBatalla()
{
game.say(jefe, "ah la pucha")
game.schedule(1000, { self.finalizarBatalla() })
}
else
game.schedule(duracionCinematica, { self.etapaDefensa() })
}
Expand All @@ -76,19 +93,16 @@ class BossFight {
morcilla.activarMovimiento()

duracionTurnoJefe = jefe.ataque()
game.schedule(duracionTurnoJefe+100, { self.habilitarAtaque() })
game.schedule(duracionTurnoJefe+50, { self.habilitarAtaque() })
}

method finalizarBatalla() {
jefeEnBatalla = false
game.boardGround("stock_fondo2.png")
entorno.limpiarEntorno()
game.addVisual(morcilla)
entorno.volverAlHub()

morcilla.enBatalla(false)
morcilla.activarMovimiento()

jefe.posicionPrevia()
game.addVisual(jefe)
}
}

18 changes: 11 additions & 7 deletions jefe.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ class JefeInteractuable{
const property image
var property vida = 5

const posInicial = position
const posInicial = new PositionMejorada (x = position.x(), y = position.y())

method posicionPrevia() {
position = posInicial
if(!self.derrotado())
{
position = posInicial
game.addVisual(self)
}
}

method posicionBatalla() {
Expand Down Expand Up @@ -72,12 +76,12 @@ class JefeGato inherits JefeInteractuable {
method ataque() {
const opcion = (0.randomUpTo(2)).roundUp()

//if(opcion == 1)
if(opcion == 1)
return self.ataque1()
//else if(opcion == 2)
//return self.ataque2()
//else
// return 0
else if(opcion == 2)
return self.ataque2()
else
return 0
}

method ataque1() {
Expand Down
6 changes: 3 additions & 3 deletions main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ program MorcillaGame {
game.addVisual(jefeGato)

game.addVisual(morcilla)
administradorVidas.definirVidas()
administradorVidas.mostrarVidas()

game.showAttributes(morcilla)
game.showAttributes(jefeGato)
Expand All @@ -27,8 +27,8 @@ program MorcillaGame {
keyboard.a().onPressDo({ morcilla.caminarIzquierda(1) })
keyboard.space().onPressDo({ morcilla.saltar(1000) })

game.whenCollideDo(jefeDePrueba, {personaje => personaje.iniciarPeleaMorcilla(jefeDePrueba)})
game.whenCollideDo(jefeGato, {personaje => personaje.iniciarPeleaMorcilla(jefeGato)})
game.whenCollideDo(jefeDePrueba, {personaje => if(personaje === morcilla){personaje.iniciarPeleaMorcilla(jefeDePrueba)}})
game.whenCollideDo(jefeGato, {personaje => if(personaje === morcilla){personaje.iniciarPeleaMorcilla(jefeGato)}})

game.start()
}
2 changes: 1 addition & 1 deletion morcilla.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ object administradorVidas {

const vidas = [vida1, vida2, vida3, vida4, vida5]

method definirVidas() {
method mostrarVidas() {
vidas.forEach({sprite => if(sprite.id() <= vidaMaximaMorcilla){game.addVisual(sprite)}})
}

Expand Down

0 comments on commit ad2b6f8

Please sign in to comment.