Skip to content

Commit

Permalink
Mapa basico y personajes
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin-Sosa committed Oct 2, 2024
1 parent 666a4b4 commit dc5bdb9
Show file tree
Hide file tree
Showing 22 changed files with 111 additions and 8 deletions.
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.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/bloqueAgua.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/bloqueBoton.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/bloqueConAcido6.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/bloqueConBoton.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/bloqueFuego.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/boton.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.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/fireboy3.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 removed assets/golondrina.png
Binary file not shown.
Binary file added assets/level1.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/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/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/watergirl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file added elementos.wlk
Empty file.
30 changes: 22 additions & 8 deletions main.wpgm
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import wollok.game.*
import mapa.*
import personajes.*

import pepita.*

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

game.addVisual(pepita)
program FireboyAndWatergirl {
game.title("Fireboy and Watergirl")
game.height(16)
game.width(15)
game.cellSize(80)
game.boardGround("bg.png")
game.addVisual(fireboy)
game.addVisual(watergirl)
mapa.inciar()

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

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

game.whenCollideDo(fireboy, {elemento =>
elemento.tratarColision(fireboy)
})

game.start()
}
36 changes: 36 additions & 0 deletions mapa.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
object mapa
{
method crearBloques(y, xi, xf, tipo)
{
(xi..xf).forEach({ x =>
const nuevoBloque = new Bloque()
nuevoBloque.position(game.at(x, y))
nuevoBloque.image(tipo)
game.addVisual(nuevoBloque)
})
}

method inciar()
{
self.crearBloques(1, 0, 2, "bloque.png")
self.crearBloques(1, 13, 15, "bloque.png")
self.crearBloques(2, 6, 10, "bloque.png")
self.crearBloques(3, 0, 4, "bloque.png")
self.crearBloques(6, 2, 15, "bloque.png")
self.crearBloques(9, 0, 12, "bloque.png")
self.crearBloques(12, 0, 2, "bloque.png")
self.crearBloques(13, 4, 15, "bloque.png")

self.crearBloques(0, 5, 6, "bloqueFuego.png")
self.crearBloques(0, 9, 10, "bloqueAgua.png")
self.crearBloques(2, 8, 8, "bloqueConAcido6.png")
self.crearBloques(6, 4, 4, "bloqueBoton.png")

}
}

class Bloque
{
var property position = game.at(0,0)
var property image = ""
}
53 changes: 53 additions & 0 deletions personajes.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
object fireboy
{
var property position = game.at(0,0)
var cantSaltos = 0
method image() = "fireboy3.png"
method movIzquierda()
{
position = position.left(1)
}
method movDerecha()
{
position = position.right(1)
}
method movSaltar()
{
if(cantSaltos < 2)
{
position = position.up(1)
cantSaltos += 1
game.schedule(800, {
position = position.down(1)
if(cantSaltos==2) cantSaltos = 0
})
}
}
}

object watergirl
{
var property position = game.at(0,2)
var cantSaltos = 0
method image() = "watergirl.png"
method movIzquierda()
{
position = position.left(1)
}
method movDerecha()
{
position = position.right(1)
}
method movSaltar()
{
if(cantSaltos < 2)
{
position = position.up(1)
cantSaltos += 1
game.schedule(800, {
position = position.down(1)
if(cantSaltos==2) cantSaltos = 0
})
}
}
}

0 comments on commit dc5bdb9

Please sign in to comment.