Hi everyone!
I'm making my first Renpy game, and I'm trying to have a single piece of music play uninterrupted from the start of the game until the user closes the program. So far I've managed to transition from main menu into the start of the game without the music starting over from the beginning. I've done this by using the queue statement to play the music both at the beginning of the main_menu label and the beginning of the start label.
However, at the end of the game when the user is returned to the main menu, the music starts over. I've tried to work around this by using jump main_menu at the end of my game script instead of return, but this takes me to the pause menu instead of the actual start-of-the-program menu.
How do I prevent the music from restarting at the end of the game?
Uninterrupted music after the game ends
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.
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.
-
- Newbie
- Posts: 2
- Joined: Wed Jul 18, 2018 3:01 pm
- Tumblr: ghastlydisco
- Contact:
- Imperf3kt
- Lemma-Class Veteran
- Posts: 3794
- Joined: Mon Dec 14, 2015 5:05 am
- itch: Imperf3kt
- Location: Your monitor
- Contact:
Re: Uninterrupted music after the game ends
You cannot, at least, not as I understand it.
When the game ends and the main menu is called, Ren'Py is basically restarting.
When the game ends and the main menu is called, Ren'Py is basically restarting.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
- Per K Grok
- Miko-Class Veteran
- Posts: 882
- Joined: Fri May 18, 2018 1:02 am
- Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
- itch: per-k-grok
- Location: Sverige
- Contact:
Re: Uninterrupted music after the game ends
Ghastly Disco wrote: ↑Wed Jul 18, 2018 3:37 pm Hi everyone!
I'm making my first Renpy game, and I'm trying to have a single piece of music play uninterrupted from the start of the game until the user closes the program. So far I've managed to transition from main menu into the start of the game without the music starting over from the beginning. I've done this by using the queue statement to play the music both at the beginning of the main_menu label and the beginning of the start label.
However, at the end of the game when the user is returned to the main menu, the music starts over. I've tried to work around this by using jump main_menu at the end of my game script instead of return, but this takes me to the pause menu instead of the actual start-of-the-program menu.
How do I prevent the music from restarting at the end of the game?
One thing you could consider is to have an end screen where the player gets the option to close the game without returning to the main menu or to return to the main menu.
Code: Select all
screen theEnd():
text "GAME OVER" xpos 100 ypos 175
textbutton "Quit" action Quit() xpos 100 ypos 200
textbutton "Main menu" action MainMenu() xpos 100 ypos 220
The player that chose the Quit alternative will have the music playing from start to closing
- MaydohMaydoh
- Regular
- Posts: 165
- Joined: Mon Jul 09, 2018 5:49 am
- Projects: Fuwa Fuwa Panic
- Tumblr: maydohmaydoh
- Location: The Satellite of Love
- Contact:
Re: Uninterrupted music after the game ends
You could try using renpy.music.get_playing to get something like something like
Should stop the play statement from restarting the song upon entering the main menu
I think that should work, maybe?
Code: Select all
define song = "song.ogg"
label main_menu:
if song != renpy.music.get_playing():
play music song
##rest of code
label start:
##do stuff
return
I think that should work, maybe?
-
- Newbie
- Posts: 2
- Joined: Wed Jul 18, 2018 3:01 pm
- Tumblr: ghastlydisco
- Contact:
Re: Uninterrupted music after the game ends
Thanks for the tip! I tried it but it didn't work for me.MaydohMaydoh wrote: ↑Thu Jul 19, 2018 1:52 am You could try using renpy.music.get_playing to get something like something likeShould stop the play statement from restarting the song upon entering the main menuCode: Select all
define song = "song.ogg" label main_menu: if song != renpy.music.get_playing(): play music song ##rest of code label start: ##do stuff return
I think that should work, maybe?
I'll just accept this as a limitation of the engine.
Re: Uninterrupted music after the game ends
Ah Ren'py, this love-hate relationship can't go on like this. Wanted to prove Per K Grok wrong, unfortunately his evaluation is correct, this is a limitation of the engine. As far as I can tell Ren'py's version of pygame doesn't even have the normal mixer functionality.
There is however a way to go around and sneak up on renpy.
http://www.mediafire.com/file/f731bi34u ... t.exe/file
It needs this file^
Create a new test project and paste this code, then copy the file to its game folder
Hint: q
There is however a way to go around and sneak up on renpy.
Code: Select all
init python:
import subprocess
import os
def resource_path(relative_path):
try:
base_path = config.basedir
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
subprocess.Popen(resource_path("game\\sound_test.exe"))
label start:
"start"
"end"
It needs this file^
Create a new test project and paste this code, then copy the file to its game folder
Hint: q
Phoenix Star - Persistence, perseverance, ambition.
...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Deviant Art: ...
Lost Legends
[VN][Fantasy][Open World] Lost Legends
(Bug Thread) Lost Legends
(Direct Download)
Discord: saltome
Itch: Phoenix Start
Who is online
Users browsing this forum: No registered users