BGM and SFX

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
yuirei
Regular
Posts: 47
Joined: Fri Aug 04, 2006 10:00 am
Contact:

BGM and SFX

#1 Post by yuirei »

Hi to all =)

I would just like to ask if there's a way to play BGM and SFX as objects .. like "bgm01.play()", instead of directly calling the renpy.music_start() static method =)?

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#2 Post by PyTom »

Actually, renpy.music_start is deprecated in favor of renpy.music.play.

But no, there's not. Why do you want to do this? If it's to abstract out the sound filenames, the way to do that is to use variables:

Code: Select all

init:
    $ snd_scream = "scream.wav"

$ renpy.sound.play(snd_scream)
Of course, if you really insist on using an object, it would be fairly easy to define one.

(The acceleration blew out on my video card, making me an unhappy camper. At least I can RMA it.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

yuirei
Regular
Posts: 47
Joined: Fri Aug 04, 2006 10:00 am
Contact:

#3 Post by yuirei »

nice idea there ^-^ I'll just do it with variables then ^^
Why do you want to do this?
I try not to "hard code" the filename parameter of the audio elements as much as possible; so when I decide to change it in the middle of development I could easily modify it on one single line ^^

Btw, thanks Tom ur the best :D

User avatar
PyTom
Ren'Py Creator
Posts: 16088
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

#4 Post by PyTom »

yuirei wrote:I try not to "hard code" the filename parameter of the audio elements as much as possible; so when I decide to change it in the middle of development I could easily modify it on one single line
This is the right attitude to have, by the way... good for you for having it.

(BTW, did you draw your avatar? I can't tell if that's Shana or not.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

yuirei
Regular
Posts: 47
Joined: Fri Aug 04, 2006 10:00 am
Contact:

#5 Post by yuirei »

BTW, did you draw your avatar? I can't tell if that's Shana or not
nope, it's by Mitsumi Misato (artist) of ToHeart2; her (avatar) name is Kousaka Tamaki ^^ (I wish I could draw like her though)

Post Reply

Who is online

Users browsing this forum: Google [Bot]