This site requires JavaScript, please enable it in your browser!
Greenfoot back
nigavart
nigavart wrote ...

2020/11/19

How to add background music?

nigavart nigavart

2020/11/19

#
i want to add music but i dont know how pls help me i need the easiest wat
Super_Hippo Super_Hippo

2020/11/19

#
This code will loop the music when the scenario is running. Change "filename.filetype" to your music file saved in the sounds folder. Place the code into your active world.
private GreenfootSound bgMusic = new GreenfootSound("filename.filetype");

public void started()
{
    bgMusic.playLoop();
}

public void stopped()
{
    bgMusic.pause();
}
nigavart nigavart

2020/11/20

#
where i have to put it? in my world or world?
danpost danpost

2020/11/20

#
nigavart wrote...
where i have to put it? in my world or world?
You cannot edit World.
nigavart nigavart

2020/11/20

#
so in my world?
nigavart nigavart

2020/11/20

#
but how to insert the name of the song?
danpost danpost

2020/11/20

#
nigavart wrote...
but how to insert the name of the song?
How is it named in your sounds folder (of your project folder in your file directory)?
You need to login to post a reply.