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

Music in specific screen only

#1 Post by UnitedAIRWAYS » Wed Aug 21, 2019 4:17 am

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
Posts: 398
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia

Re: Music in specific screen only

#2 Post by IrinaLazareva » Thu Aug 22, 2019 12:35 pm

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)
There is a light at the end of the tunnel, just pray it's not a train.

TODO: unresolved/нерешённое

Post Reply

Who is online

Users browsing this forum: Google [Bot]