Skip to content

Commit

Permalink
chau hasta mañana
Browse files Browse the repository at this point in the history
  • Loading branch information
tomassagrada committed Oct 2, 2024
1 parent afd08ac commit 3ff6b40
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 20 deletions.
8 changes: 4 additions & 4 deletions characters.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Character {
const unidadSaltar = 5

method position() = position

method image() {
return "" // Sobrescrito en las subclase
}
Expand All @@ -19,7 +19,7 @@ class Character {

method jump() {
position.goUp(unidadSaltar)
game.schedule(1000, {self.fall()})
game.schedule(500, {self.fall()})
}

method fall() {
Expand All @@ -29,7 +29,7 @@ class Character {

class Fireboy inherits Character {

const isFireboy = true
method isFireboy() = true

override method image() {
return "Fireboy.png"
Expand All @@ -38,7 +38,7 @@ class Fireboy inherits Character {

class Watergirl inherits Character {

const isFireboy = false
method isFireboy() = false

override method image() {
return "Watergirl.png"
Expand Down
22 changes: 10 additions & 12 deletions elements.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import characters.*

// ------------------ Diamantes

class Diamond {
var isCollected = false
class Diamante {

const posX
const posY
Expand All @@ -12,15 +11,14 @@ class Diamond {

method colision(personaje) {

if (self.canCollect(personaje) && !isCollected) { // Personaje puede recogerlo y todavia no fue recogido
isCollected = true
if (self.canCollect(personaje)) { // Personaje puede recogerlo y todavia no fue recogido
game.removeVisual(self)
// efecto visual, sonido, palabritas

}
}

method canCollect(character) {
method canCollect(personaje) {
// Sobrescrito en las subclases
return false
}
Expand All @@ -30,27 +28,27 @@ class Diamond {
}
}

class RedDiamond inherits Diamond {
class DiamanteRojo inherits Diamante {
override method image() {
return "diamante_rojo.png"
}

override method canCollect(character) {
return character.isFireboy() // Solo puede ser recogido por Fireboy
override method canCollect(personaje) {
return personaje.isFireboy() // Solo puede ser recogido por Fireboy
}
}

class BlueDiamond inherits Diamond {
class DiamanteAzul inherits Diamante {
override method image() {
return "diamante_azul.png"
}

override method canCollect(character) {
return !character.isFireboy() // Solo puede ser recogido por Fireboy
override method canCollect(personaje) {
return !personaje.isFireboy() // Solo puede ser recogido por Watergirl
}
}

class GreenDiamond inherits Diamond {
class DiamanteVerde inherits Diamante {
override method image() {
return "diamante_verde.png"
}
Expand Down
65 changes: 65 additions & 0 deletions log/wollok16.log

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions log/wollok17.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"exitCode":"SIGINT","level":"info","message":"👾 Game executed main.FireBoyWaterGirlGame on c:\\Users\\tomas\\Downloads\\UTN\\Algoritmos\\2024-o-tpjuego-pasteldepapa","timeElapsed":79591,"timestamp":"2024-10-02T17:24:30.093Z"}
8 changes: 4 additions & 4 deletions main.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ program FireBoyWaterGirlGame {

// Diamantes

const redDiamonds = [new RedDiamond(posX = 5, posY = 0), new RedDiamond(posX = 8, posY = 0)] // Diamantes rojos
const blueDiamonds = [new BlueDiamond(posX = 4, posY = 0), new BlueDiamond(posX = 2, posY = 0)] // Diamantes azules
const diamantesRojos = [new DiamanteRojo(posX = 5, posY = 0), new DiamanteRojo(posX = 8, posY = 0)] // Diamantes rojos
const diamantesAzules = [new DiamanteAzul(posX = 4, posY = 0), new DiamanteAzul(posX = 2, posY = 0)] // Diamantes azules

// Agregar todos los diamantes rojos al juego
redDiamonds.forEach{diamond => game.addVisual(diamond)}
diamantesRojos.forEach{diamante => game.addVisual(diamante)}

// Agregar todos los diamantes azules al juego
blueDiamonds.forEach {diamond => game.addVisual(diamond)}
diamantesAzules.forEach {diamante => game.addVisual(diamante)}

// Movimientos

Expand Down

0 comments on commit 3ff6b40

Please sign in to comment.