Skip to content

Commit

Permalink
creamos el juego homero para que se mueva de izq a derecha y agarre l…
Browse files Browse the repository at this point in the history
…a rosquilla y la banana y le aplicamos un fondo.

Co-authored-by: MatttiB <[email protected]>
  • Loading branch information
acorromolas11 and MatttiB committed Oct 1, 2024
1 parent d307f31 commit 5dadcb9
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 34 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# (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

(completar...)

## Controles:

- `W` para...
- `A` para moverse a la izquierda.
- `D` para moverse a la derecha.

Binary file added assets/banana.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/homero.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/rosquilla.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/springfield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions homero.wlk
Original file line number Diff line number Diff line change
@@ -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
}

Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 24 additions & 7 deletions main.wpgm
Original file line number Diff line number Diff line change
@@ -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()
}
}
16 changes: 0 additions & 16 deletions pepita.wlk

This file was deleted.

11 changes: 5 additions & 6 deletions pruebas.wtest
Original file line number Diff line number Diff line change
@@ -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" {

}

}

0 comments on commit 5dadcb9

Please sign in to comment.