Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
brisabrussa28 committed Oct 14, 2024
1 parent 7b76214 commit d633dbb
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 76 deletions.
106 changes: 32 additions & 74 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,7 @@ import muros.*

import puntos.*

object fondo_de_pausa{
var property position = game.origin()
method image() = "pausa.png"
}

object ganaste{
var property position = game.at(0,3)
method image() = "ganaste.png"
}

object menuPersonajes{
var property position = game.origin()
method image() = "FondoSeleccion2.png"
}

object noSeleccionado{
var direccion = 1
method direccion(numero){
direccion = numero
}
method position() = if(direccion == 1) game.at(2,5) else game.at(10,5)
method image() = "no.png"
}

object siSeleccionado{
var direccion = 0
method direccion(numero){
direccion = numero
}
method position() = if(direccion == 0) game.at(10,5) else game.at(2,5)
method image() = "si.png"
}

object menuNiveles{
var property position = game.origin()
method image() = "niveles.png"
}

object seleccion{
var property position = game.at(1, 11)
method image() = "nivel_s.png"
}

object bloqueado{
var property position = game.at(1, 1)
method image() = "bloqueado.png"
}
import miscelaneos.*

program BadIceCreamGame {
game.cellSize(40) //ancho del helado
Expand Down Expand Up @@ -89,47 +43,30 @@ program BadIceCreamGame {
}

object juego{
var inicio = false
method menuNiveles(){
var x = seleccion.position().x()
var y = seleccion.position().y()
keyboard.a().onPressDo({
if(seleccion.position().x() >= 1){
seleccion.position(game.at(x-2,y))
if(seleccion.position() == game.at(1,9)){
game.addVisual(bloqueado)
} else {
game.removeVisual(bloqueado)
}
if(seleccion.position().x() > 1){
seleccion.position(game.at(seleccion.position().x()-2,seleccion.position().y()))
self.bloquear()
}
})
keyboard.d().onPressDo({
if(seleccion.position().x() < 14){
seleccion.position(game.at(x+2,y))
if(seleccion.position() == game.at(1,9)){
game.addVisual(bloqueado)
} else {
game.removeVisual(bloqueado)
}
seleccion.position(game.at(seleccion.position().x()+2,seleccion.position().y()))
self.bloquear()
}
})
keyboard.w().onPressDo({
if(seleccion.position().y() < 11){
seleccion.position(game.at(x,y+2))
if(seleccion.position() == game.at(1,9)){
game.addVisual(bloqueado)
} else {
game.removeVisual(bloqueado)
}
seleccion.position(game.at(seleccion.position().x(),seleccion.position().y()+2))
self.bloquear()
}
})
keyboard.s().onPressDo({
if(seleccion.position().y() > 3){
seleccion.position(game.at(x,y-2))
if(seleccion.position() == game.at(1,9)){
game.addVisual(bloqueado)
} else {
game.removeVisual(bloqueado)
}
seleccion.position(game.at(seleccion.position().x(),seleccion.position().y()-2))
self.bloquear()
}
})
keyboard.enter().onPressDo({
Expand Down Expand Up @@ -169,6 +106,7 @@ object juego{
}

method jugar(){
if(!inicio){
//dibujar muros
muros.crearLaterales()
//dibujar escenario
Expand All @@ -180,7 +118,27 @@ object juego{
//dibujar jugador
game.addVisualCharacter(jugador)
game.showAttributes(jugador)
inicio = true
}
}

method bloquear(){
if(!inicio){
if(bloqueados.any({bloqueado => bloqueado == seleccion.position()})){
game.addVisual(bloqueado)
} else {
game.removeVisual(bloqueado)
}
}
}
const bloqueados = [game.at(1,3),game.at(1,5),game.at(1,7),game.at(1,9),
game.at(3,3),game.at(3,5),game.at(3,7),game.at(3,9),
game.at(5,3),game.at(5,5),game.at(5,7),game.at(5,9),game.at(5,11),
game.at(7,3),game.at(7,5),game.at(7,7),game.at(7,9),game.at(7,11),
game.at(9,3),game.at(9,5),game.at(9,7),game.at(9,9),game.at(9,11),
game.at(11,3),game.at(11,5),game.at(11,7),game.at(11,9),game.at(11,11),
game.at(13,3),game.at(13,5),game.at(13,7),game.at(13,9),game.at(13,11),
game.at(15,3),game.at(15,5),game.at(15,7),game.at(15,9),game.at(15,11)]
}

object interactuador{
Expand Down
47 changes: 47 additions & 0 deletions miscelaneos.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
object fondo_de_pausa{
var property position = game.origin()
method image() = "pausa.png"
}

object ganaste{
var property position = game.at(0,3)
method image() = "ganaste.png"
}

object menuPersonajes{
var property position = game.origin()
method image() = "FondoSeleccion2.png"
}

object noSeleccionado{
var direccion = 1
method direccion(numero){
direccion = numero
}
method position() = if(direccion == 1) game.at(2,5) else game.at(10,5)
method image() = "no.png"
}

object siSeleccionado{
var direccion = 0
method direccion(numero){
direccion = numero
}
method position() = if(direccion == 0) game.at(10,5) else game.at(2,5)
method image() = "si.png"
}

object menuNiveles{
var property position = game.origin()
method image() = "niveles.png"
}

object seleccion{
var property position = game.at(1, 11)
method image() = "nivel_s.png"
}

object bloqueado{
var property position = game.at(1, 1)
method image() = "bloqueado.png"
}
4 changes: 2 additions & 2 deletions muros.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ object muros{
}

object escenario{
var listan = []
var listan = niveles.get(0)

method generarLista(indice){
listan = niveles.get(indice)
Expand Down Expand Up @@ -55,7 +55,7 @@ object escenario{
game.at(2,10), game.at(4,9), game.at(5,4), game.at(6,8), game.at(7,8), game.at(8,8), game.at(9,9), game.at(10,7), game.at(11,9), game.at(12,6), game.at(13,9), game.at(15,9),
game.at(2,9), game.at(4,8), game.at(5,2), game.at(6,6), game.at(7,6), game.at(8,6), game.at(9,6), game.at(10,4), game.at(11,8), game.at(12,3), game.at(13,8), game.at(15,8),
game.at(2,8), game.at(4,7), game.at(6,4), game.at(7,4), game.at(8,4), game.at(9,4), game.at(10,2), game.at(11,5), game.at(13,7), game.at(15,7),
game.at(2,7), game.at(4,6), game.at(6,2), game.at(7,2), game.at(8,2), game.at(9,2), game.at(11,3), game.at(13,6), game.at(15,6),
game.at(2,7), game.at(4,6), game.at(6,2), game.at(7,2), game.at(8,2), game.at(9,2), game.at(11,2), game.at(13,6), game.at(15,6),
game.at(2,6), game.at(4,4), game.at(13,4), game.at(15,5),
game.at(2,5), game.at(4,2)]
]
Expand Down

0 comments on commit d633dbb

Please sign in to comment.