Skip to content

Commit

Permalink
pantallaGanaste
Browse files Browse the repository at this point in the history
  • Loading branch information
OrianaIsabel committed Oct 17, 2024
1 parent c837f91 commit 97d3072
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
19 changes: 17 additions & 2 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ object juego{
var seleccionado = 0
method menuNiveles(){ //SELECCION DE NIVELES
game.addVisual(menuNiveles)
seleccion.posicionParaNiveles()
game.addVisual(seleccion)
keyboard.a().onPressDo({
if(seleccion.position().x() > 1){
Expand Down Expand Up @@ -150,10 +151,24 @@ object juego{
seleccion.posicionParaPantallaGanaste()
game.addVisual(seleccion)
keyboard.a().onPressDo({
if (seleccion.position() == game.at(8,5)) seleccion.position(game.at(6,5))
if (seleccion.position().x() < 10) seleccion.position(game.at(6, 5))
})
keyboard.d().onPressDo({
if (seleccion.position() == game.at(6,5)) seleccion.position(game.at(8,5))
if (seleccion.position().x() > 6) seleccion.position(game.at(10, 5))
})
//Por alguna razon se mueve al presionar w y s, asi que lo restringi
keyboard.w().onPressDo({
seleccion.position(game.at(seleccion.position().x(), 5))
})
keyboard.s().onPressDo({
seleccion.position(game.at(seleccion.position().x(), 5))
})
keyboard.enter().onPressDo({
if (seleccion.position() == game.at(6, 5)) {
game.removeVisual(seleccion)
self.menuNiveles()
}
if (seleccion.position() == game.at(10, 5)) game.stop()
})
}
}
Expand Down
5 changes: 4 additions & 1 deletion miscelaneos.wlk
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ object menuNiveles{
}

object seleccion{
var property position = game.at(1, 11)
var property position = game.origin()
method image() = "nivel_s.png"
method posicionParaNiveles() { //Posicion que tendra en la pantalla de niveles
position = game.at(1, 11)
}
method posicionParaPantallaGanaste() { //Se aplica metodo para reutilizar el visual al final del juego en otra posicion
position = game.at(6, 5)
}
Expand Down

0 comments on commit 97d3072

Please sign in to comment.