diff --git a/README.md b/README.md index 4a885a1..d33f6ad 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,19 @@ -# (reemplazar nombre de juego acá) +# El Sueño del Levantapalas: La Carrera por el Morfi UTN - Facultad Regional Buenos Aires - Materia Paradigmas de Programación ## Equipo de desarrollo: -- completar... -- completar... +- Bermejo Fernández, Matías. +- Corro Molas, Agustin. +- Britos, Aylen. +- Dimotta, Cecilia. +- Giangrandi, Agostino. ## Capturas -![pepita](assets/golondrina.png) +![homeroGame](image.png) ## Reglas de Juego / Instrucciones @@ -18,5 +21,6 @@ UTN - Facultad Regional Buenos Aires - Materia Paradigmas de Programación ## Controles: -- `W` para... +- `A` para moverse a la izquierda. +- `D` para moverse a la derecha. diff --git a/assets/banana.png b/assets/banana.png new file mode 100644 index 0000000..ee0558a Binary files /dev/null and b/assets/banana.png differ diff --git a/assets/homero.png b/assets/homero.png new file mode 100644 index 0000000..36d17c3 Binary files /dev/null and b/assets/homero.png differ diff --git a/assets/rosquilla.png b/assets/rosquilla.png new file mode 100644 index 0000000..6054976 Binary files /dev/null and b/assets/rosquilla.png differ diff --git a/assets/springfield.png b/assets/springfield.png new file mode 100644 index 0000000..1128e80 Binary files /dev/null and b/assets/springfield.png differ diff --git a/homero.wlk b/homero.wlk new file mode 100644 index 0000000..adac809 --- /dev/null +++ b/homero.wlk @@ -0,0 +1,65 @@ +import wollok.game.* + +object puntosHomero { + const hom = homero + const position = new MutablePosition(x=7, y=9) + + method position() = position + + method text () = "Puntos: " + hom.puntos() + " Velocidad: " + hom.velocidad() + +} + +object homero{ + var puntos = 0 + var velocidad = 1 + const position = new MutablePosition(x=7, y=0) + + method image() = "homero.png" + method position() = position + + method moverseIzquierda(){ + position.goLeft(velocidad) + } + + method moverseDerecha(){ + position.goRight(velocidad) + } + + method alterarPuntos(nuevosPuntos){ + puntos += nuevosPuntos + puntos = puntos.max(0) + } + + method alterarVelocidad(nuevaVelocidad){ + velocidad += nuevaVelocidad + velocidad = velocidad.max(1) + } + + method puntos() = puntos + + method velocidad() = velocidad +} + +class Rosquilla { + const position = new MutablePosition(x=0, y=0) + const puntos = 10 + const velocidad = 1 + + method position() = position + method image() = "rosquilla.png" + method puntos () = puntos + method velocidad () = velocidad +} + +class Banana { + const position = new MutablePosition(x=game.width()-2, y=0) + const puntos = -5 + const velocidad = -1 + + method position() = position + method image() = "banana.png" + method puntos () = puntos + method velocidad () = velocidad +} + diff --git a/image.png b/image.png new file mode 100644 index 0000000..0a1cb82 Binary files /dev/null and b/image.png differ diff --git a/main.wpgm b/main.wpgm index 4337325..664f411 100644 --- a/main.wpgm +++ b/main.wpgm @@ -1,16 +1,33 @@ import wollok.game.* -import pepita.* +import homero.* -program PepitaGame { - game.title("Pepita") + +program homeroGame{ + game.title("Homero") game.height(10) - game.width(10) + game.width(15) game.cellSize(100) - game.addVisual(pepita) + const rosquilla = new Rosquilla() + const banana = new Banana() + + game.boardGround("springfield.png") + game.addVisual(puntosHomero) + game.addVisual(homero) + game.addVisual(rosquilla) + game.addVisual(banana) + + game.onCollideDo(homero, {rosquilla => homero.alterarPuntos(rosquilla.puntos())}) + game.onCollideDo(homero, {rosquilla => homero.alterarVelocidad(rosquilla.velocidad())}) + game.onCollideDo(homero, {rosquilla => game.removeVisual(rosquilla)}) + game.onCollideDo(homero, {banana => homero.alterarPuntos(banana.puntos())}) + game.onCollideDo(homero, {banana => homero.alterarVelocidad(banana.velocidad())}) + game.onCollideDo(homero, {banana => game.removeVisual(banana)}) + - keyboard.w().onPressDo({ pepita.fly(1) }) + keyboard.a().onPressDo({ homero.moverseIzquierda()}) + keyboard.d().onPressDo({ homero.moverseDerecha()}) game.start() -} +} \ No newline at end of file diff --git a/pepita.wlk b/pepita.wlk deleted file mode 100644 index 8763973..0000000 --- a/pepita.wlk +++ /dev/null @@ -1,16 +0,0 @@ -object pepita { - var energy = 100 - const position = new MutablePosition(x=0, y=0) - - method image() = "golondrina.png" - method position() = position - - method energy() = energy - - method fly(minutes) { - energy = energy - minutes * 3 - position.goRight(minutes) - position.goUp(minutes) - } - -} \ No newline at end of file diff --git a/pruebas.wtest b/pruebas.wtest index 7342cd1..c62ee20 100644 --- a/pruebas.wtest +++ b/pruebas.wtest @@ -1,9 +1,8 @@ -import pepita.* +import homero.* +import wollok.game.* -describe "group of tests for pepita" { - - test "pepita has initial energy" { - assert.equals(100, pepita.energy()) +describe "homero" { + test "tests para el game de homero" { + } - } \ No newline at end of file