Music in specific screen only

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
UnitedAIRWAYS
Newbie
Posts: 9
Joined: Tue Jul 02, 2019 12:51 pm
Contact:

Music in specific screen only

#1 Post by UnitedAIRWAYS »

Hello, how do I do such thing? When user calls a screen (e.g. a map), then a music starts to play in a loop and when he goes to another screen or closes the map one, the music stops. Thank you very much!

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Music in specific screen only

#2 Post by IrinaLazareva »

Code: Select all

screen demo_imagemap():
    # <elements of the screen>

    on 'show' action Play('music', 'music_file.mp3', fadein=0.4, fadeout=1.0)
    on 'hide' action Stop('music', fadeout=2.7)
https://renpy.org/doc/html/screen_actions.html#Play
https://renpy.org/doc/html/screen_actions.html#Stop
https://renpy.org/doc/html/screens.html#on

Post Reply

Who is online

Users browsing this forum: mold.FF