Skip to content

Commit

Permalink
bloqueado
Browse files Browse the repository at this point in the history
  • Loading branch information
brisabrussa28 committed Oct 13, 2024
1 parent 9b67566 commit 7b76214
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ object seleccion{
method image() = "nivel_s.png"
}

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

program BadIceCreamGame {
game.cellSize(40) //ancho del helado
game.title("Bad Ice Cream")
Expand Down Expand Up @@ -90,21 +95,41 @@ object juego{
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)
}
}
})
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)
}
}
})
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)
}
}
})
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)
}
}
})
keyboard.enter().onPressDo({
Expand Down

0 comments on commit 7b76214

Please sign in to comment.