Skip to content

Commit

Permalink
agrego menu
Browse files Browse the repository at this point in the history
  • Loading branch information
marsegovia authored Nov 28, 2024
1 parent a5230be commit 0832784
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,32 @@ program meteoricSpace {
game.boardGround("hud.png")

var juegoIniciado = false
var pantallaInicio = new ObjetoJuego(position = game.at(0, 0), image = "pantalla de inicio8.png")
var pantallaInicio = new ObjetoJuego(position = game.at(0, 0), image = "inicio (6).png")
var pantallaControls = new ObjetoJuego(position = game.at(0,0), image = "controles.png")
var pantallaSettings = new ObjetoJuego(position = game.at(0,0), image = "")
var pantallaGameOver = new ObjetoJuego(position = game.at(0, 0), image = "pantalla de fin.png")
var pantallaHowtoPlay = new ObjetoJuego(position = game.at(0,0), image = "howtoplay.png")
var musica = game.sound("8bits.mp3")
game.addVisual(pantallaInicio)
musica.play()
musica.volume(1)

//keyboard.s().onPressDo({ game.addVisual()})

keyboard.h().onPressDo({game.addVisual(pantallaHowtoPlay)})

keyboard.q().onPressDo({game.addVisual(pantallaControls)})

keyboard.backspace().onPressDo({
game.removeVisual(pantallaControls)
game.removeVisual(pantallaHowtoPlay)
game.removeVisual(pantallaControls)
})

keyboard.enter().onPressDo({
if (!juegoIniciado) {
juegoIniciado = true
game.removeVisual(pantallaInicio)}



if (juegoIniciado){
var balas = []
Expand All @@ -32,8 +48,6 @@ var pantallaGameOver = new ObjetoJuego(position = game.at(0, 0), image = "pantal
game.addVisual(sumar_minicion)
game.addVisual(poner_Escudo)



// Movimiento de la nave
keyboard.right().onPressDo({
if(nave.position().x() < fondo.limite_derecho()) {
Expand Down Expand Up @@ -196,12 +210,14 @@ var pantallaGameOver = new ObjetoJuego(position = game.at(0, 0), image = "pantal
if (nave.colisionaCon(meteorito)) {
meteoritosABorrar.add(meteorito)
nave.perderVida()
game.addVisual(pantallaGameOver)
if (nave.vida() <= 0) {
game.removeVisual(meteoritos)
game.removeVisual(sumar_minicion)
game.removeVisual(poner_Escudo)
game.removeVisual(reducir_velocidad)
game.addVisual(pantallaGameOver)
game.stop()
game.onTick(500, "", {game.stop()})
}

}
Expand Down

0 comments on commit 0832784

Please sign in to comment.