Okay, I now did a version of answering your question that still allows the user to go to menus. It uses a function to start and stop the audio and uses that same function to pause the audio when in one of the menus.
Code: Select all
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8", what_slow_cps=20, what_slow_abortable=False,
stop_on_mute=False, callback=clicks)
init -1 python:
renpy.music.register_channel("Chan1", mixer= "sfx", loop=True)
def clack_play(on=False):
if on:
renpy.music.play("click.wav", channel="Chan1")
else:
renpy.music.stop(channel="Chan1")
def clicks(event, **kwargs):
if event == "show" or event == "begin":
clack_play(True)
if event == "slow_done" or event == "end":
clack_play(False)
# The game starts here.
label start:
e "You've created a new Ren'Py game."
e "Once you add a story, pictures, and music, you can release it to the world!"
return
Okay, to make this work, you also have to add this line to your screens code:
Code: Select all
on "show" action Function(clack_play)
Where do you add it? Three places.
In the save, load screen area, add it twice:
Code: Select all
screen save():
# This ensures that any other menu screen is replaced.
tag menu
use navigation
use file_picker
on "show" action Function(clack_play)
screen load():
# This ensures that any other menu screen is replaced.
tag menu
use navigation
use file_picker
on "show" action Function(clack_play)
Right under that, in the preferences area add it under use navigation:
Code: Select all
screen preferences():
tag menu
# Include the navigation.
use navigation
on "show" action Function(clack_play)
That works for me as a way to deal with your audio, but also allow your players to go to the game menus while a slow text is on. I use a version of this method to make sure the tick tock of my clock CCD stops clicking when you go to the menu.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe:
http://lemmasoft.renai.us/forums/viewto ... 51&t=21978