[solved] Can I make just one "hotspot" to do it?

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
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

[solved] Can I make just one "hotspot" to do it?

#1 Post by Nanahs »

If I have an image like this one on my game:

Image

I wanted the person to click on this image and the sound of an offline tv ("oflinnetv.mp3") to start playing.
And when the person clicked the tv again, the sound would stop.

But the problem is: there's already a song playing. And I didn't want it to be stopped.

So, is it possible to create a hotspot where I could play "oflinnetv.mp3" as a sound and when clicking there again, only the tv sound would stop playing? And not the background music.

I had added a "action PauseAudio" and everything stopped playing.The sound, but also the music.

Thanks :)
Last edited by Nanahs on Tue Oct 09, 2018 8:20 am, edited 1 time in total.

User avatar
parttimestorier
Veteran
Posts: 429
Joined: Thu Feb 09, 2017 10:29 pm
Completed: No Other Medicine, Well Met By Moonlight, RE:BURN, The Light at the End of the Ocean, Take A Hike!, Wizard School Woes
Projects: Seeds of Dreams
itch: janetitor
Location: Canada
Contact:

Re: Can I make just one "hotspot" to do it?

#2 Post by parttimestorier »

If you want to have the TV sound and background music playing at once, and to be able to stop one but not the other, you just need to make sure they're on different channels. The easiest way to do that would be to have the background music on the "music" channel and the TV sound on the "sound" channel, which are the channels that automatically exist already. So you would start them like this:

Code: Select all


play music "whatever_the_file_name_is.mp3"

play sound "oflinnetv.mp3" loop

You need to add "loop" to the "play sound" command if you want the TV sound to keep repeating until you tell it to stop, because by default the music channel loops and the sound channel doesn't. Then when you want the TV sound to stop, just say "stop sound". I'm pretty sure that would work! You could also check this section of the documentation for more information.
ImageImageImage

User avatar
Nanahs
Veteran
Posts: 310
Joined: Wed Aug 22, 2018 5:50 pm
Contact:

Re: Can I make just one "hotspot" to do it?

#3 Post by Nanahs »

parttimestorier wrote: Mon Oct 08, 2018 10:36 pm If you want to have the TV sound and background music playing at once, and to be able to stop one but not the other, you just need to make sure they're on different channels. The easiest way to do that would be to have the background music on the "music" channel and the TV sound on the "sound" channel, which are the channels that automatically exist already. So you would start them like this:

Code: Select all


play music "whatever_the_file_name_is.mp3"

play sound "oflinnetv.mp3" loop

You need to add "loop" to the "play sound" command if you want the TV sound to keep repeating until you tell it to stop, because by default the music channel loops and the sound channel doesn't. Then when you want the TV sound to stop, just say "stop sound". I'm pretty sure that would work! You could also check this section of the documentation for more information.
Thank you so much for your help! :)

Post Reply

Who is online

Users browsing this forum: No registered users