Skip to content

Commit

Permalink
Cambios varios
Browse files Browse the repository at this point in the history
Co-authored-by: Bruno <[email protected]>
  • Loading branch information
Juanter134 and bcochon committed Nov 13, 2024
1 parent f984f74 commit 7f9c1f7
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 43 deletions.
Binary file added assets/INVminiMorcilla.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/INVmorcilla6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/arena_de_jefe.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/vacio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 35 additions & 22 deletions entorno.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ object entorno {

self.limpiarEntorno()

game.addVisual(morcilla)
morcilla.mostrar()

jefesHub.forEach({jefe => jefe.posicionPrevia()})
jefesHub.forEach({jefe => if(!jefe.derrotado()){jefe.posicionPrevia()}})

if (jefesDerrotados == jefesHub.size()) {
//game.schedule(1000, game.addVisual(jefeFinal))
Expand All @@ -37,13 +37,16 @@ object entorno {
}

method reiniciarJuego() {
const personajes = [morcilla, jefePerro, jefeGato]
const personajes = [morcilla, jefePerro, jefeGato, jefeFinal]

jefesDerrotados = 0

self.limpiarEntorno()

personajes.forEach({personaje => personaje.estadoInicial()}) // revisar

game.addVisual(morcilla)
morcilla.mostrar()
game.schedule(200,{jefeFinal.ocultar()})
}
}

Expand All @@ -57,6 +60,16 @@ class Colisiones {
class Visual {
const property position
var property image

method mostrar() {
if(!game.hasVisual(self))
game.addVisual(self)
}

method ocultar() {
if(game.hasVisual(self))
game.removeVisual(self)
}
}

class Cinematica {
Expand All @@ -65,38 +78,41 @@ class Cinematica {
var frameActual = 0
const property position = game.origin()
var image = "261.jpg"
const duracionFrame = 200

method image() = image

method empezar() {
image = frames.head()
game.onTick(100, id, {self.siguienteFrame()})
game.onTick(duracionFrame, id, {self.siguienteFrame()})
game.addVisual(self) // arbitrario para saber si funciona

game.schedule(self.duracion() + 110, { game.removeTickEvent(id) })
game.schedule(self.duracion(), { self.terminar() })
}

method terminar() {
game.removeTickEvent(id)
game.removeVisual(self)
}

method siguienteFrame() {
if(frameActual < frames.size()) {
if(frameActual +1 < frames.size()) {
frameActual += 1
image = frames.get(frameActual)
}
else {
frames.forEach({frame => game.removeVisual(frame)})
}

}

method duracion() = frames.size() * 100
method duracion() = frames.size() * duracionFrame
}

const cartelAtaque = new Visual (position = new Position(x=17, y=20), image = "proto_cartel_ataque.png")
const fondoJefe = new Visual (position = game.origin(), image = "arena_de_jefe.png")

//const cinematicaDerrota = new Cinematica (id = "derrota", frames = ["261.jpg"])
//const cinematicaAtaque = new Cinematica (id = "ataque", frames = ["261.jpg"])
//const cinematicaJefePerro = new Cinematica (id = "gato", frames = ["261.jpg"])
//const cinematicaJefeGato = new Cinematica (id = "perro", frames = ["261.jpg"])
//const cinematicaJefeFinal = new Cinematica (id = "final", frames = ["261.jpg"])
const cinematicaDerrota = new Cinematica (id = "derrota", frames = ["261.jpg"])
const cinematicaAtaque = new Cinematica (id = "ataque", frames = ["261.jpg"])
const cinematicaJefePerro = new Cinematica (id = "gato", frames = ["261.jpg"])
const cinematicaJefeGato = new Cinematica (id = "perro", frames = ["261.jpg"])
const cinematicaJefeFinal = new Cinematica (id = "final", frames = ["261.jpg"])


// =============================================== BOSSFIGHTS ===============================================
Expand All @@ -110,12 +126,12 @@ class BossFight {
if (!jefe.derrotado()) {
game.boardGround("arena_de_jefe.png")
entorno.limpiarEntorno()
game.addVisual(morcilla)
morcilla.mostrar()
morcilla.enBatalla(true)
jefeEnBatalla = true

jefe.posicionBatalla()
game.addVisual(jefe)
jefe.mostrar()

self.habilitarAtaque()
keyboard.e().onPressDo({self.gestionarAtaque()})
Expand All @@ -142,10 +158,7 @@ class BossFight {
jefe.disminuirVida()

if(jefe.derrotado())
{
game.say(jefe, "ah la pucha")
game.schedule(1000, { self.finalizarBatalla() })
}
else
game.schedule(duracionCinematica, { self.etapaDefensa() })
}
Expand Down
12 changes: 12 additions & 0 deletions general.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,16 @@ class PositionMejorada inherits MutablePosition {
method verticalMejorado(pasos, limiteSup, limiteInf) {
y = (y+pasos).min(limiteSup).max(limiteInf)
}
}

class Personaje {
method mostrar() {
if(!game.hasVisual(self))
game.addVisual(self)
}

method ocultar() {
if(game.hasVisual(self))
game.removeVisual(self)
}
}
10 changes: 3 additions & 7 deletions jefe.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ import entorno.*
import wollok.game.*
import morcilla.*
import general.*
import proyectiles.*
import ataques.*

class Jefe {
class Jefe inherits Personaje{
var property position
const property image
var property vida
Expand All @@ -22,11 +21,8 @@ class Jefe {
}

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

method posicionBatalla() {
Expand All @@ -38,7 +34,7 @@ class Jefe {
vida = (vida - 1).max(0)
}

method derrotado() = vida <= 0
method derrotado() = vida <= 0

method ataque() {
const ataqueActual = ataques.head()
Expand Down
14 changes: 10 additions & 4 deletions main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ program MorcillaGame {
game.height(32)
game.width(33)
game.cellSize(100)

fondoJefe.mostrar()

keyboard.t().onPressDo({ fondoJefe.image("arena_de_jefe.png") })
keyboard.o().onPressDo({ fondoJefe.image("vacio.png") })

jefePerro.mostrar()
jefeGato.mostrar()

game.addVisual(jefePerro)
game.addVisual(jefeGato)

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

game.showAttributes(morcilla)
Expand All @@ -26,7 +32,7 @@ program MorcillaGame {
keyboard.d().onPressDo({ morcilla.caminarDerecha(1) })
keyboard.a().onPressDo({ morcilla.caminarIzquierda(1) })
keyboard.space().onPressDo({ morcilla.saltar(1000) })
keyboard.r().onPressDo({ entorno.reiniciarJuego() })


game.whenCollideDo(morcilla, {elemento => elemento.tocaMorcilla()})

Expand Down
25 changes: 15 additions & 10 deletions morcilla.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import general.*
import entorno.*
import jefe.*

object morcilla {
object morcilla inherits Personaje{
var property position = self.posicionInicial()
const vidaInicial = 3

Expand All @@ -22,16 +22,21 @@ object morcilla {
method suspendido() = suspendido

method image() {

var imagen = ""
if(inmunidadActiva)
imagen = "INV"

if(derrotado)
return "261.jpg"
else if(suspendido)
return framesSalto.get(frameSaltoActual)
return imagen+framesSalto.get(frameSaltoActual)
else
{
if(position.x()%2 == 0)
return "morcilla0.png"
return imagen+"morcilla0.png"
else
return "morcilla1.png"
return imagen+"morcilla1.png"
}
}

Expand Down Expand Up @@ -102,7 +107,7 @@ object morcilla {
var inmunidadActiva = false
var property puedeAtacar = false
var derrotado = false
var enBatalla = false
var enBatalla = false

method enBatalla(estado){
enBatalla = estado
Expand All @@ -111,7 +116,6 @@ object morcilla {
method iniciarPeleaMorcilla(jefe, espera){
if(!enBatalla) {
self.desactivarMovimiento()
game.say(jefe, "Has llegado morcilla. Ahora nos vamos a agarrar")

game.schedule(espera, jefe.nuevaPelea())
}
Expand All @@ -120,7 +124,6 @@ object morcilla {
method perderVida() {
if (!inmunidadActiva){
vidas = (vidas-1).max(0)
game.say(self, "Ay!")

administradorVidas.actualizarVida(vidas)

Expand All @@ -136,17 +139,19 @@ object morcilla {
game.schedule(duracion, {inmunidadActiva = false})
}

method derrota() { // Terminar de hacer
method derrota() {
derrotado = true
self.desactivarMovimiento()

//cinematicaDerrota.empezar()
cinematicaDerrota.empezar()

game.schedule(cinematicaDerrota.duracion()+200, {entorno.reiniciarJuego()})
}

method derrotado() = derrotado

method atacar() {
//cinematicaAtaque.empezar()
cinematicaAtaque.empezar()
}

method posicionDeAtaque() {
Expand Down

0 comments on commit 7f9c1f7

Please sign in to comment.