Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #1

Open
wants to merge 23 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
666a4b4
Setting up GitHub Classroom Feedback
github-classroom[bot] Oct 2, 2024
dc5bdb9
Mapa basico y personajes
Valentin-Sosa Oct 2, 2024
e8de9ee
Mapa mejorado y con los elementos
Valentin-Sosa Oct 2, 2024
e3f45e5
Mejora logica de creacion de bloques y colision basica
Valentin-Sosa Oct 2, 2024
ed892e3
cambios en tests y juego en gnrl
AlvaroGianola Oct 17, 2024
d2738ba
Cambio README.md
AlvaroGianola Oct 17, 2024
e9f68ae
Refactor personajes y colisiones de tierra,fuego,agua
Valentin-Sosa Oct 17, 2024
66dfa50
Merge branch 'main' of github.com:pdepjm/2024-o-tpjuego-no-se-que-poner
Valentin-Sosa Oct 17, 2024
999cea1
Funcionalidad de palanca y su elevador
Valentin-Sosa Oct 17, 2024
b10cf15
Algunos sonidos y funcionalidad boton
Valentin-Sosa Oct 17, 2024
dfa5469
Nuevo boton para terminar funcionalidad
Valentin-Sosa Oct 17, 2024
3fdc8d1
Nuevo tipo de bloque y nueva imagen boton
Valentin-Sosa Oct 17, 2024
fb0205e
sonido de muerte agregado
Valentin-Sosa Oct 17, 2024
1de2f2e
Algunas simplifaciones de codigo
Valentin-Sosa Oct 23, 2024
ee0d180
Test de comportamiento de un personaje, fireboy, y watergirl
Valentin-Sosa Oct 26, 2024
327b675
correciones pedidas hechas
Valentin-Sosa Nov 6, 2024
e65cf01
Funcionamiento del cubo
Valentin-Sosa Nov 6, 2024
ff1c8c9
Sistema de reinicio y ganar mediante las puertas
Valentin-Sosa Nov 6, 2024
d2aa954
Logica añadida de multiples elevadores
Valentin-Sosa Nov 6, 2024
1dc45b2
Tests terminados, logica del juego terminada
Valentin-Sosa Nov 6, 2024
7b39ca0
FIN
AlvaroGianola Nov 7, 2024
c09b1e6
TE MENTI ESTE SI ES EL FIN
AlvaroGianola Nov 7, 2024
c18005a
cambio puertas (checkeo por tipo)
AlvaroGianola Nov 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 64 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,77 @@
# (reemplazar nombre de juego acá)
# El Pibe Fuego y La Minita Agua

UTN - Facultad Regional Buenos Aires - Materia Paradigmas de Programación

## Equipo de desarrollo:

- completar...
- completar...

- Kevin Anton (kevinanton01)
- Alex Fiorenza (alexFiorenza)
- Alvaro Federico Gianola (AlvaroGianola)
- Natali Martirosyan (NatyMartirosyan)
- Valentin Sosa (Valentin-Sosa)

## Capturas

![pepita](assets/golondrina.png)

## Reglas de Juego / Instrucciones

(completar...)
Intentar llegar a las puertas con ambos personajes (cada uno a su respectiva puerta)
evitando los charcos de agua,
fuego, ácido, interactuando con los diversos elementos y haciendo los saltos con un buen timing.

## Controles:

- `W` para...
- watergirl (la celeste):
~ a y d para moverse
~ w para saltar
~ s para interactuar con palancas, puertas y mover cajas

- fireboy (el rojo)
~ flechas izquierda y derecha para moverse
~ flecha arriba para saltar
~ flecha abajo para interactuar con palancas y puertas (solo las mujeres empoderadas pueden mover cajas)

## Explicaciones Teóricas:
Aplicamos los conceptos de polimorfismo a la forma en la que colisiona cada personaje con cada bloque/charco y con cada puerta.
Aplicamos también conceptos de clases y herencia para la creación del mapa (ya que este constaba de muchos bloques iguales de las distintas clases), ambos personajes(compartian metodos),
los elementos con los que se puede interactuar, etc.
POR EJEMPLO: en la creacion del mapa existian muchos bloques iguales de las diversas clases, que a su vez todos los bloques de tierra, por ejemplo, deben colisionar de la misma forma con los personajes.

DIAGRAMA (introducir el sigiente codigo en yuml)
// Sweet Class Diagram
// Diagrama de Clases para Fireboy and Watergirl en Wollok
// -----------------------------------------------------

// Relaciones de herencia
[Personaje]^-[fireboy]
[Personaje]^-[watergirl]
[Elemento]^-[Elevador]
[Elemento]^-[Boton]
[Elemento]^-[Puerta]
[Boton]^-[botonAbajo]
[Boton]^-[botonArriba]
[Elevador]^-[elevadorPorBoton]
[Elevador]^-[elevadorPorPalanca]
[Puerta]^-[puertaFuego]
[Puerta]^-[puertaAgua]
[Elemento]^-[cubo]
[Elemento]^-[cartelGanador]
[Elemento]^-[cartelPerdedor]
[Objeto]|create>[Elemento]

// Clases con propiedades y métodos destacados
[≪IDisposable≫;Personaje|+position: Posicion;+estaMuerto: Boolean;-cantSaltos: Int|moverse(nuevaPosicion);movIzquierda();movDerecha();movSaltar();caer();morir();reiniciar()]

[Elevador|posicionInicial: Posicion;activado: Boolean|cambiarEstado(nuevoEstado);reiniciar();position()]
[Boton|position: Posicion|estaPresionado()]
[Puerta|condicion: Function;imagenCerrada: String|hayAlguienEnPuerta();chequearPuerta()]

// Relaciones de composición
[game]<>-*[fireboy]
[game]<>-*[watergirl]
[game]<>-*[cubo]
[game]<>-*[elevadorPorBoton]
[game]<>-*[elevadorPorPalanca]

// Detalles adicionales
[fireboy]-[note: Fireboy personaje controlado por jugador]
[watergirl]-[note: Watergirl personaje controlado por jugador]
[cubo]-[note: Puede ser movido y presionar botones]
Binary file added assets/acido46.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/activar.ogg
Binary file not shown.
Binary file added assets/bg.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/bloque.ogg
Binary file not shown.
Binary file added assets/bloqueDeAgua.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/bloqueDeFuego.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/bloquePinchos.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/bloqueTierra2.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/boton2.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/cubo.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/elevador.ogg
Binary file not shown.
Binary file added assets/elevador2.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/fireboy6.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/gameover.ogg
Binary file not shown.
Binary file added assets/ganar.ogg
Binary file not shown.
Binary file added assets/ganaste.jpg
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/ganaste2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/golondrina.png
Binary file not shown.
Binary file added assets/morir.ogg
Binary file not shown.
Binary file added assets/palanca.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/perdiste.jpg
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/perdiste2.jpg
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/perdiste3.jpg
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/puerta.ogg
Binary file not shown.
Binary file added assets/puertaAbierta.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/puertaAgua.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/puertaFuego.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/salto.ogg
Binary file not shown.
Binary file added assets/soundtrack.ogg
Binary file not shown.
Binary file added assets/watergirl3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
225 changes: 225 additions & 0 deletions elementos.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
import personajes.*
import mapa.*

class Elemento
{
var property position
method puedeSerAtravesado() = true
method puedeSerPresionado() = false
method puedePresionarBoton() = false
method puedeSerMovido() = false
method tratarColision(personaje) {}
}
class Elevador
{
const posicionInicial
const offset
var property activado = false
method image() = "elevador2.png"
method puedeSerAtravesado() = false

method cambiarEstado(nuevoEstado)
{
if(nuevoEstado != activado)
{
activado = nuevoEstado
game.sound("elevador.ogg").play()
}
}

method position()
{
if(activado){
return posicionInicial.down(offset)
}

return posicionInicial
}

method reiniciar()
{
activado = false
}
}

class ElevadorPorBoton inherits Elevador
{
const botonAsociado1
const botonAsociado2

method chequearSusBotones()
{
if(botonAsociado1.estaPresionado() || botonAsociado2.estaPresionado()) self.cambiarEstado(true)
else self.cambiarEstado(false)
}

method agregarseAlMapa()
{
game.addVisual(self)
game.addVisual(botonAsociado1)
game.addVisual(botonAsociado2)
}
}

class ElevadorPorPalanca inherits Elevador
{
const palancaAsociada

method chequearSuPalanca()
{
if(palancaAsociada.estaActiva()) self.cambiarEstado(true)
else self.cambiarEstado(false)
}

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

override method reiniciar()
{
super()
palancaAsociada.reiniciar()
}
}
class Boton inherits Elemento
{
method image() = "boton2.png"

method estaPresionado()
{
const posibles = game.getObjectsIn(self.position())
return posibles.any({objeto => objeto.puedePresionarBoton()})
}
}
class Palanca inherits Elemento
{
var property estaActiva = false
method image() = "palanca.png"

override method puedeSerPresionado() = true

method activar() {
estaActiva = !estaActiva
game.sound("activar.ogg").play()
}

method reiniciar()
{
estaActiva = false
}
}

const primerElevadorPorBoton = new ElevadorPorBoton (posicionInicial = game.at(14, 9),
botonAsociado1 = new Boton (position = game.at(5, 7)),
botonAsociado2 = new Boton (position = game.at(10, 10)),
offset = 1)
const segundoElevadorPorBoton = new ElevadorPorBoton(posicionInicial = game.at(8,14),
botonAsociado1 = new Boton (position = game.at(4, 14)),
botonAsociado2 = new Boton (position = game.at(12, 14)),
offset = -1)

const primerElevadorPorPalanca = new ElevadorPorPalanca (posicionInicial = game.at(0, 6),
palancaAsociada = new Palanca (position = game.at(3, 4)),
offset = 1)
const palancaMultiple = new Palanca(position = game.at(6,16))

const segundoElevadorPorPalanca = new ElevadorPorPalanca (posicionInicial = game.at(9, 17),
palancaAsociada = palancaMultiple,
offset = 1)
const terceroElevadorPorPalanca = new ElevadorPorPalanca (posicionInicial = game.at(7, 18),
palancaAsociada = palancaMultiple,
offset = 1)
const cuartoElevadorPorPalanca = new ElevadorPorPalanca (posicionInicial = game.at(5, 19),
palancaAsociada = palancaMultiple,
offset = 1)
object cubo inherits Elemento (position = game.at(6, 10))
{
method image() = "cubo.png"
override method puedeSerAtravesado() = false

override method puedeSerMovido() = true

method moverse(desplazamiento)
{
position = game.at(position.x() + desplazamiento, position.y())
game.sound("bloque.ogg").play()
}

method reiniciar()
{
position = game.at(6, 10)
}
}

class Puerta inherits Elemento
{
const property tipo
method puedeAbrirla(personaje) = (tipo == personaje.tipo())
const imagenCerrada
var property estaAbierta = false
//method puedeAbrirPuertaFuego() = false
//method puedeAbrirPuertaAgua() = false
method image()
{
if(estaAbierta) return "puertaAbierta.png"
return imagenCerrada
}

method hayAlguienEnPuerta()
{
const posibles = game.getObjectsIn(self.position())
return posibles.any({ p => (self.puedeAbrirla(p) && self!=p) })
}

method chequearPuerta()
{
if(self.hayAlguienEnPuerta() && !estaAbierta)
{
estaAbierta = self.hayAlguienEnPuerta()
game.sound("puerta.ogg").play()
}
if (juego.condicionesGanadoras())
{
juego.ganaste()
}
}
}

const puertaFuego = new Puerta(position = game.at(3, 19), imagenCerrada = "puertaFuego.png", tipo = fuego)

const puertaAgua = new Puerta (position = game.at(1, 19), imagenCerrada = "puertaAgua.png", tipo = agua)

/*class Puerta inherits Elemento
{
const condicion
const imagenCerrada
var property estaAbierta = false
method puedeAbrirPuertaFuego() = false
method puedeAbrirPuertaAgua() = false
method image()
{
if(estaAbierta) return "puertaAbierta.png"
return imagenCerrada
}

method hayAlguienEnPuerta()
{
const posibles = game.getObjectsIn(self.position())
return posibles.any(condicion)
}

method chequearPuerta()
{
if(self.hayAlguienEnPuerta() != estaAbierta)
{
estaAbierta = self.hayAlguienEnPuerta()
game.sound("puerta.ogg").play()
}
}
}

const puertaFuego = new Puerta(position = game.at(3, 19), imagenCerrada = "puertaFuego.png", condicion = {p => p.puedeAbrirPuertaFuego()})

const puertaAgua = new Puerta (position = game.at(1, 19), imagenCerrada = "puertaAgua.png", condicion = {p => p.puedeAbrirPuertaAgua()})*/
41 changes: 33 additions & 8 deletions main.wpgm
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
import wollok.game.*
import mapa.*
import personajes.*
import elementos.*

import pepita.*

program PepitaGame {
game.title("Pepita")
game.height(10)
game.width(10)
game.cellSize(100)
program FireboyAndWatergirl {

game.addVisual(pepita)
mapa.inciar()
game.addVisual(fireboy)
game.addVisual(watergirl)

keyboard.w().onPressDo({ pepita.fly(1) })
keyboard.left().onPressDo({fireboy.movIzquierda()})
keyboard.right().onPressDo({fireboy.movDerecha()})
keyboard.up().onPressDo({fireboy.movSaltar()})
keyboard.down().onPressDo({fireboy.presionar()})

keyboard.w().onPressDo({watergirl.movSaltar()})
keyboard.a().onPressDo({watergirl.movIzquierda()})
keyboard.d().onPressDo({watergirl.movDerecha()})
keyboard.s().onPressDo({watergirl.moverElemento()})

keyboard.r().onPressDo({juego.reiniciar()})

game.whenCollideDo(fireboy, {elemento => elemento.tratarColision(fireboy)})
game.whenCollideDo(watergirl, {elemento => elemento.tratarColision(watergirl)})
game.onTick(200, "Chequear elevadores por boton", {primerElevadorPorBoton.chequearSusBotones() segundoElevadorPorBoton.chequearSusBotones()})
game.onTick(1000, "Chequear elevadores por palanca", {primerElevadorPorPalanca.chequearSuPalanca()
segundoElevadorPorPalanca.chequearSuPalanca()
terceroElevadorPorPalanca.chequearSuPalanca()
cuartoElevadorPorPalanca.chequearSuPalanca()})
game.onTick(1000, "Chequear puertas", {puertaAgua.chequearPuerta() puertaFuego.chequearPuerta()})
//game.onTick(1000, "Chequear victoria", {if(juego.condicionesGanadoras()) juego.ganaste()})
//game.onTick(1000, "Chequear derrota", {if(juego.condicionesPerdedoras()) juego.perdiste()})

soundtrack.shouldLoop(true)
game.schedule(500, { soundtrack.play()} )

game.start()

}
Loading
Loading