How to fade out main menu music when click in start game

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
pink_cherry

How to fade out main menu music when click in start game

#1 Post by pink_cherry »

Hi everyone... I'm new here and I tried to find this question in other topics but I couldn't.

So what I want to do is to put a background music in the main menu that continues looping and then, when player clicks on 'start game', the music fades out and stops.

I tried using this...

config.main_menu_music = "bgm1.mp3"

but when I start a new game, the music keeps playing until it finishes

I know this question could be foolish, but it's my first time using ren'py :roll:

Thanks in advance...

yummy
Miko-Class Veteran
Posts: 733
Joined: Fri Jul 07, 2006 9:58 pm
Projects: Suna to Majo
Location: France
Contact:

#2 Post by yummy »

I don't really know what you want to do. Fade out the music or make it stop?
In anycase, there's this old trick:

Code: Select all

python hide:
        if renpy.sound.is_playing(channel=7):
            renpy.music.stop()
Stops all the musics.

I might be a little outdated, wasn't it supposed to be written

Code: Select all

library.main_menu_music = "bgm1.mp3"
instead ?

User avatar
PyTom
Ren'Py Creator
Posts: 16097
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#3 Post by PyTom »

You're a little outdated. :-) A while back, I merged together config. and library., with config. being the preferred way of doing things.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
DaFool
Lemma-Class Veteran
Posts: 4171
Joined: Tue Aug 01, 2006 12:39 pm
Contact:

#4 Post by DaFool »

Just have the first line in the script of the game proper be something like
$renpy.music.stop(fadeout = 0.5) [Please doublecheck exact syntax as I am quoting this naked]

pink_cherry
Newbie
Posts: 1
Joined: Sun May 06, 2007 4:09 am
Contact:

#5 Post by pink_cherry »

Thank you all for the help...

But as I dig more into ren'py more doubts come out...

This time I found the code to change the image buttons and labels

Code: Select all

init:
    python:
        config.image_buttons["Save Game"] = (
            "but_idle.png",
            "but_hover.png",
            "but_sel_idle.png",
            "but_sel_hover.png",
            "but_disable.png")

        config.image_labels["Music Volume"] = "lab_music_volume.png" 
The problem I have...(this is going to sound totally stupid...) :? ...but, where am I supposed to put in this code...in script.rpy? options.rpy? or where?...

Sorry for my stupid questions

Indeed it was a stupid question :lol:

Ok...I managed to find out my mistake and how to correct it...

However...if I get stucked again with something I'll post it...


:wink:

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot], Semrush [Bot]