Skip to content

Commit

Permalink
hola ya funciona falta que funcione mejor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomassagrada committed Oct 2, 2024
1 parent 32767a5 commit afd08ac
Show file tree
Hide file tree
Showing 20 changed files with 947 additions and 34 deletions.
File renamed without changes
33 changes: 19 additions & 14 deletions characters.wlk
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
class Character {
const position = new MutablePosition(x=0, y=0)
const position = new MutablePosition(x=1, y=0)
const unidadCaminar = 1
const unidadSaltar = 5

var canTouchFire
var isFireboy
method position() = position

method image() {
return "" // Sobrescrito en las subclase
}

method moveLeft() {
position.goLeft(unidadCaminar)
Expand All @@ -16,26 +19,28 @@ class Character {

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

method fall() {
position.goDown(unidadSaltar)
}
}

class Fireboy extends Character {
const imagePath = "Fireboy.png"
var canTouchFire = true
var isFireboy = true
class Fireboy inherits Character {

const isFireboy = true

method image() = imagePath
override method image() {
return "Fireboy.png"
}
}

class Watergirl extends Character {
const imagePath = "Watergirl.png"
var canTouchFire = false
var isFireboy = false
class Watergirl inherits Character {

const isFireboy = false

method image() = imagePath
override method image() {
return "Watergirl.png"
}
}
10 changes: 5 additions & 5 deletions elements.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Diamond {

class RedDiamond inherits Diamond {
override method image() {
return "diamante_rojo.png" // Devuelve la imagen específica del diamante rojo
return "diamante_rojo.png"
}

override method canCollect(character) {
Expand All @@ -42,17 +42,17 @@ class RedDiamond inherits Diamond {

class BlueDiamond inherits Diamond {
override method image() {
return "diamante_azul.png" // Devuelve la imagen específica del diamante azul
return "diamante_azul.png"
}

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

class GreenDiamond inherits Diamond {
override method image() {
return "diamante_verde.png" // Devuelve la imagen específica del diamante verde
return "diamante_verde.png"
}

override method canCollect(character) {
Expand Down Expand Up @@ -108,5 +108,5 @@ class Platform {
character.position.goTo(positionX, positionY); // Coloca al personaje en la plataforma
}
}
}
}*/

479 changes: 479 additions & 0 deletions log/wollok1.log

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions log/wollok10.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok11.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok12.log

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions log/wollok13.log

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions log/wollok14.log

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions log/wollok15.log

Large diffs are not rendered by default.

50 changes: 50 additions & 0 deletions log/wollok16.log

Large diffs are not rendered by default.

217 changes: 217 additions & 0 deletions log/wollok2.log

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions log/wollok3.log

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions log/wollok4.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok5.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok6.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok7.log

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions log/wollok8.log

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions log/wollok9.log

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions main.wpgm
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import wollok.game.*

import characters.*
import elements.*

Expand All @@ -9,39 +8,40 @@ program FireBoyWaterGirlGame {
// Juego

game.title("FireBoyWaterGirlGame")
game.boardGround("nivel_1.webp")
game.boardGround("nivel_1.png")
game.height(50)
game.width(50)
game.cellSize(60)

// Personajes

var fireboy = new Fireboy()
var watergirl = new Watergirl()
const fireboy = new Fireboy()
const watergirl = new Watergirl()

game.addVisual(fireboy)
game.addVisual(watergirl)

// Diamantes

var redDiamonds = [new RedDiamond(posX = 3, posY = 5), new RedDiamond(posX = 5, posY = 7)] // Diamantes rojos
var blueDiamonds = [new BlueDiamond(posX = 4, posY = 6), new BlueDiamond(posX = 2, posY = 8)] // Diamantes azules
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

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

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

// Movimientos

keyPressed('left', fireboy.moveLeft)
keyPressed('right', fireboy.moveRight)
keyPressed('up', fireboy.jump)

keyPressed('a', watergirl.moveLeft)
keyPressed('d', watergirl.moveRight)
keyPressed('w', watergirl.jump)
keyboard.a().onPressDo({ watergirl.moveLeft()})
keyboard.d().onPressDo({ watergirl.moveRight() })
keyboard.w().onPressDo({ watergirl.jump() })

keyboard.left().onPressDo({ fireboy.moveLeft() })
keyboard.right().onPressDo({ fireboy.moveRight() })
keyboard.up().onPressDo({ fireboy.jump() })


// Manejar Colisiones (por ahora solo esta las de diamantes)

Expand Down

0 comments on commit afd08ac

Please sign in to comment.