Main menu music continues playing when game starts

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
freakyladymoonbeam
Newbie
Posts: 2
Joined: Mon Aug 01, 2016 3:25 pm
Projects: Chadtronic: A Short Dating Sim
Location: Ontario, Canada
Contact:

Main menu music continues playing when game starts

#1 Post by freakyladymoonbeam » Mon Aug 01, 2016 4:49 pm

So, I inserted music to the main menu, but I don't how to make it stop once I click "Start Game". How do I get it to stop?

Here is the code I currently have inputted, up to where the game code starts:

Code: Select all

# Declare images used by this game.
image bg hallway = "hallway.jpg"
image bg outside_school = "outside_school.jpg"

# Declare characters used by this game.
define c = Character('Chad', color="#00FEF8")
define w = Character('Wendy', color="#FF96FF")

init python:
    config.main_menu_music = "chadtronic.wav"

init:
    # Two-window mode.
    $ ctwo = Character(_('Chad'),
                       color="#00FEF8",
                       show_two_window=True)
    $ wtwo = Character(_('Wendy'),
                       color="FF96FF",
                       show_two_window=True)
    
    # Slow text.
    $ wslow = Character(_("Wendy"),
                        color="#FF96FF",
                        what_slow_cps=20)

# The game starts here.

User avatar
Pando
Regular
Posts: 29
Joined: Wed Oct 08, 2014 7:57 am
Projects: Crossfire
Organization: Agape Studios
IRC Nick: Pando
Github: Scylardor
Contact:

Re: Main menu music continues playing when game starts

#2 Post by Pando » Tue Aug 02, 2016 8:10 am

You should just have to call "stop music" at the start of your first scene. Does it work ?
That's how I do it usually.

Be sure to check the Audio documentation, there are lots of useful informations about the sound there.
Image

User avatar
PurpleMind
Regular
Posts: 104
Joined: Mon May 19, 2014 5:38 am
Completed: I contributed to 15 visual novels so far!
Projects: Might of Merchants, Black Heaven VN
Location: Cracow, Poland
Discord: Marek Domagała#1778
Contact:

Re: Main menu music continues playing when game starts

#3 Post by PurpleMind » Thu Aug 04, 2016 12:50 pm

Shouldn't this be moved into some Ren'Py help section?

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

Re: Main menu music continues playing when game starts

#4 Post by Taleweaver » Fri Aug 12, 2016 5:08 am

Yes, yes it should.

Moved.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

Post Reply

Who is online

Users browsing this forum: No registered users