Skip to content

Commit

Permalink
no logro corregir lo del slime agil
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasSchkurko committed Dec 9, 2024
1 parent 26dd3b2 commit 6c7562e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 16 deletions.
22 changes: 16 additions & 6 deletions administradorDeEnemigos.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,27 @@ object administradorDeEnemigos {
cantDeEnemigosPorLinea.get(linea).restarCantidad()
}

method hayEnemigoFila(numeroFila) = cantDeEnemigosPorLinea.get(numeroFila).cantEnemigos() > 0
method hayEnemigoFila(numeroFila) = cantDeEnemigosPorLinea.get(numeroFila).tieneEnemigos()

}

class Linea{


const linea = 0

method position() = new MutablePosition(x = 13, y = linea)
method text() = cantEnemigos.toString()


var property cantEnemigos =0

method reset(){
cantEnemigos = 0
}

method tieneEnemigos()= cantEnemigos > 0

method aumentarCant() {
cantEnemigos+=1
}
Expand All @@ -102,8 +112,8 @@ class Linea{
}
}

const linea1 = new Linea()
const linea2 = new Linea()
const linea3 = new Linea()
const linea4 = new Linea()
const linea5 = new Linea()
const linea1 = new Linea(linea=0)
const linea2 = new Linea(linea=1)
const linea3 = new Linea(linea=2)
const linea4 = new Linea(linea=3)
const linea5 = new Linea(linea=4)
6 changes: 5 additions & 1 deletion administradorDeJuego.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,11 @@ object configuracion {

menu.iniciarTienda()


//game.addVisual(linea1)
//game.addVisual(linea2)
//game.addVisual(linea3)
//game.addVisual(linea4)
//game.addVisual(linea5)
}

// Método para programar eventos de actualización periódicos (ticks)
Expand Down
8 changes: 4 additions & 4 deletions administradorDeOleadas.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ const nivel2 = new Nivel(oleadas=[[slimeBasico,slimeBasico,slimeGuerrero,slimeDo
[slimeGuerrero,slimeLadron,slimeGuerrero,slimeLadron,slimeBasico],
[slimeAgil,slimeGuerrero,slimeLadron,slimeBasico],
[slimeAgil,slimeGuerrero,slimeLadron,slimeBasico],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja]],tiempoSpawn=4000, cantidadEnemigos=6,nombre="2")
const nivel3 = new Nivel(oleadas=[[slimeBasico, slimeBasico, slimeGuerrero,slimeLadron],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja]],tiempoSpawn=4000, cantidadEnemigos=6,nombre="2") // [slimeBasico, slimeBasico, slimeGuerrero,slimeLadron]
const nivel3 = new Nivel(oleadas=[[slimeAgil, slimeAgil, slimeAgil,slimeAgil],
[slimeGuerrero,slimeLadron,slimeGuerrero,slimeLadron,slimeBasico],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja,slimeBomba],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja,slimeBomba],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja,slimeBomba]],
tiempoSpawn=3000, cantidadEnemigos=7,nombre="3")
tiempoSpawn=5000, cantidadEnemigos=7,nombre="3")
const nivel4 = new Nivel(oleadas=[[slimeBasico, slimeBasico, slimeGuerrero,slimeLadron],
[slimeGuerrero,slimeLadron,slimeGuerrero,slimeLadron,slimeBasico],
[slimeAgil,slimeGuerrero,slimeLadron,slimeNinja],
Expand All @@ -215,7 +215,7 @@ const nivel4 = new Nivel(oleadas=[[slimeBasico, slimeBasico, slimeGuerrero,slime
[slimeBomba, slimeNinja,slimeLadron,slimeAgil],
[slimeGuerrero,slimeLadron,slimeGuerrero,slimeLadron,slimeBlessed],
[slimeBlessed, slimeNinja, slimeBomba]],
tiempoSpawn=4000, cantidadEnemigos=8,nombre="4")
tiempoSpawn=2000, cantidadEnemigos=8,nombre="4")

//algo asi deberia ser nivefinal
object nivelInfinito inherits Nivel(oleadas = [slimeBasico],tiempoSpawn=4000,cantidadEnemigos=3,nombre="infinito"){
Expand Down
11 changes: 8 additions & 3 deletions magos.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Mago {
// Métodos
method frenarEnemigo() = true

method enemigoEnSuFila() = administradorDeEnemigos.hayEnemigoFila(position.y())


method position() = position
method image() = imagen
Expand Down Expand Up @@ -65,20 +65,25 @@ class Mago {
class MagoQueDispara inherits Mago{
const proyectilBase
var property tipoProyectil=proyectilBase

override method disparar(){
const posicionProyectil = new MutablePosition(x = self.position().x() + 1, y = self.position().y())
if (self.enemigoEnSuFila()) {
const posicionProyectil = new MutablePosition(x = self.position().x() + 1, y = self.position().y())
administradorDeProyectiles.generarProyectil(posicionProyectil, tipoProyectil)
tipoProyectil=proyectilBase
}
tipoProyectil = proyectilBase

}

override method combinarProyectil(otroTipo){
if (tipoProyectil.condicionParaCombinarse(otroTipo) && tipoProyectil.puedeCombinarse()){
tipoProyectil = tipoProyectil.combinar()
return true
}
return tipoProyectil.condicionParaCombinarse(otroTipo) && tipoProyectil.puedeCombinarse()
}

method enemigoEnSuFila() = administradorDeEnemigos.hayEnemigoFila(self.position().y())
}


Expand Down
5 changes: 3 additions & 2 deletions slime.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,12 @@ object slimeAgil inherits Tipo(danio=50, vida=200, imagen="s.slimeAgil_01.png",i

method cambiarDeCarril()={
slime=>
const newPosicion= new MutablePosition(x = slime.position().x(), y = (slime.position().y()+((-1).randomUpTo(11.999999))).max(0).min(4)) //
const newPosicionY = (slime.position().y()+((-1).randomUpTo(2))).max(0).min(4)
const newPosicion= new MutablePosition(x = slime.position().x(), y = newPosicionY )//
if(game.getObjectsIn(newPosicion).isEmpty()){
administradorDeEnemigos.aumentarLinea(newPosicionY)
administradorDeEnemigos.decrementarLinea(slime.position().y())
slime.position(newPosicion)
administradorDeEnemigos.aumentarLinea(newPosicion.y())
}
}
}

0 comments on commit 6c7562e

Please sign in to comment.