How to add music(in the game)and a background at start menu.

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
Ruubste
Newbie
Posts: 17
Joined: Wed May 15, 2013 10:01 am
Projects: BitterSweet, Destination
Location: The Netherlands
Contact:

How to add music(in the game)and a background at start menu.

#1 Post by Ruubste » Sat May 18, 2013 10:45 am

Yeah, it's me (that noob) again. I found out how to make choices, dialogues etc. but when I try to add music I get stuck. Also, I can't even find where to put a background in the start menu. Could someone please help me?
Learn to smile at every situation. See it as an opportunity to prove your strength and ability.
Have a nice day :)

User avatar
SakuraTommiko
Newbie
Posts: 21
Joined: Fri May 17, 2013 9:54 am
Location: Philippines
Contact:

Re: How to add music(in the game)and a background at start m

#2 Post by SakuraTommiko » Sat May 18, 2013 11:20 am

well, for the music, if you're using ren'py, put:
play music "(the name of the song).(the sound format)"
before the line where you want the music to begin. Then put:
stop music "(the name of the song).(the sound format)"
after the line where you want the music to stop.
As for sound effects, just change "music" to "sound". However, it only plays once. So if you'd like to repeat it for several times, you'll need to repeat the line to how many time you'd want it to play.
As for the picture on the main menu, that's also my question... haha! So I'm sorry if I could only help you in the music. I hope this helped you!
Ah, and don't forget to put the music file into the folder of your game. Also, the name you put in the code should be the exact one, that also goes with the format. So if you'd like it to be simpler, just rename the file. If you'd like to see what the format is, just place your mouse onto the song, and a box will appear containing the details.

Sakura Tommiko :)

User avatar
Ruubste
Newbie
Posts: 17
Joined: Wed May 15, 2013 10:01 am
Projects: BitterSweet, Destination
Location: The Netherlands
Contact:

Re: How to add music(in the game)and a background at start m

#3 Post by Ruubste » Sat May 18, 2013 11:51 am

SakuraTommiko wrote:well, for the music, if you're using ren'py, put:
play music "(the name of the song).(the sound format)"
before the line where you want the music to begin. Then put:
stop music "(the name of the song).(the sound format)"
after the line where you want the music to stop.
As for sound effects, just change "music" to "sound". However, it only plays once. So if you'd like to repeat it for several times, you'll need to repeat the line to how many time you'd want it to play.
As for the picture on the main menu, that's also my question... haha! So I'm sorry if I could only help you in the music. I hope this helped you!
Ah, and don't forget to put the music file into the folder of your game. Also, the name you put in the code should be the exact one, that also goes with the format. So if you'd like it to be simpler, just rename the file. If you'd like to see what the format is, just place your mouse onto the song, and a box will appear containing the details.

Sakura Tommiko :)
Thank you, actually I already figured it out a bit but can you solve another problem?
If you want to use a background you first have to put: Image (name background), in the begining of the script. What do you have to put there instead of image when you want to put music?
Learn to smile at every situation. See it as an opportunity to prove your strength and ability.
Have a nice day :)

User avatar
Donmai
Eileen-Class Veteran
Posts: 1919
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: How to add music(in the game)and a background at start m

#4 Post by Donmai » Sat May 18, 2013 4:40 pm

To change the background of the menus look in your option.rpy for these lines:

Code: Select all

mm_root ="put the name of your image file here",
gm_root = "put the name of your image file here",
mm means "main menu" and gm means "game menu"
To play a music in the main menu look for this line in options.rpy:

Code: Select all

    config.main_menu_music = "put the name of your music file here"
You can do many interesting things with sound.
Put these lines in the very beginning of your main script:

Code: Select all

init:
    $ renpy.music.register_channel("ambient","sfx",True,tight=True)
This code is registering a sound channel named "ambient". You can use it for sound effects that you will want to play in a continuous loop (like rain, wind or a clock ticking). You can use it with

Code: Select all

play ambient "name of your sound effects file"
you have many commands to control sound, like fadein, fadeout, queue, noloop and so on

http://www.renpy.org/wiki/renpy/doc/reference/Audio
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
OokamiKasumi
Eileen-Class Veteran
Posts: 1779
Joined: Thu Oct 14, 2010 3:53 am
Completed: 14 games released -- and Counting.
Organization: DarkErotica Games
Deviantart: OokamiKasumi
Location: NC, USA
Contact:

Re: How to add music(in the game)and a background at start m

#5 Post by OokamiKasumi » Sat May 18, 2013 7:44 pm

If you're interested in changing your Backgrounds, there's a tutorial for it in the RenPy Cookbook section of the forum.
[Tutorial] Custom Backgrounds: Save/Load/Pref/Yes-No/MainMenu
Ookami Kasumi ~ Purveyor of fine Smut.
Most recent Games Completed: For ALL my completed games visit: DarkErotica Games

"No amount of great animation will save a bad story." -- John Lasseter of Pixar

Post Reply

Who is online

Users browsing this forum: Google [Bot]