Skip to content

Commit

Permalink
musica de fondo para niveles
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyleca committed Nov 6, 2024
1 parent 154bad8 commit b21718a
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 1 deletion.
Binary file added assets/BadIceCreamMusicaDeFondo.mp3
Binary file not shown.
Binary file added assets/musicaDragonBallZ.mp3
Binary file not shown.
8 changes: 8 additions & 0 deletions mainExample.wpgm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import puntos.*
import enemigos.*

import muros.*
import musica.*

program BadIceCreamGame {
game.cellSize(40)
Expand All @@ -18,7 +19,14 @@ program BadIceCreamGame {
//Inicio menu
menuPersonaje.cargar()
//inicio



game.start()





//Juego puntos
keyboard.r().onPressDo({
Expand Down
8 changes: 7 additions & 1 deletion menus.wlk
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import musica.*
import mainExample.*

import wollok.game.*
Expand Down Expand Up @@ -56,7 +57,8 @@ object menuPersonaje inherits Menus(add_1 = menuPersonajes, add_2 = marcoDeSelec
visual.valor("b_pasto_i.png")
visualSuperior.valor("b_pasto_sup.png")
spawn.puntos(["semilla.png", "capsula.png", "comida.png"])
}
musicaDeFondo.sonido(game.sound("musicaDragonBallZ.mp3"))
}
game.removeVisual(menuPersonajes)
game.removeVisual(marcoDeSeleccion)
menuNivel.cargar()
Expand Down Expand Up @@ -93,6 +95,7 @@ object menuGanaste inherits Menus(add_1 = ganaste, add_2 = seleccionGanaste, mov
game.removeVisual(fondoJuego)
game.removeVisual(points)
escenario.limpiarEscenario()
musicaDeFondo.stop()
keyboard.enter().onPressDo({
if(sincronizadorDePantallas.pantallaActual() == tipoDeMenu){
game.removeVisual(seleccionGanaste)
Expand All @@ -117,6 +120,7 @@ object menuPerdiste inherits Menus(add_1 = perdiste, add_2 = seleccionPerdiste,
game.removeVisual(fondoJuego)
game.removeVisual(points)
escenario.limpiarEscenario()
musicaDeFondo.stop()
keyboard.enter().onPressDo({
if(sincronizadorDePantallas.pantallaActual() == tipoDeMenu){
game.removeVisual(seleccionGanaste)
Expand Down Expand Up @@ -154,6 +158,8 @@ object juego{
game.addVisual(points)
//dibujar superior
escenario.generarBloquesSuperiores()
//reproducir la musica correspondiente
musicaDeFondo.play()
}
}

Expand Down
21 changes: 21 additions & 0 deletions musica.wlk
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import muros.*
// const musicaBadIceCream = new MusicaDeFondo(musica = "BadIceCreamMusicaDeFondo.mp3")

// const musicaDragonBallZ = new MusicaDeFondo(musica = "musicaDragonBallZ.mp3")

object musicaDeFondo

{
var property sonido = game.sound("BadIceCreamMusicaDeFondo.mp3")


method play(){
sonido.volume(0.25)
sonido.shouldLoop(true)
sonido.play()
}

method stop(){
sonido.stop()
}
}

0 comments on commit b21718a

Please sign in to comment.