I currently have my hotspots jump to a label, plays a sound effect and then jump to a new screen.
Is it possible to simply play a sound effect within the hotspot code when clicked on?
My current hotspot code:
hotspot (1119, 634, 139, 68) action Jump("home_frontyard") hovered ShowTransient("label_frontyard") unhovered Hide("label_frontyard")
Hotspot -> label which plays SE and then calls screen for the frontyard.
Another question... is there some code I can use within a label that will jump back to the most recent screen?
[SOLVED] Play sound on hotspot click?
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.
[SOLVED] Play sound on hotspot click?
Last edited by renpyhelp on Thu Mar 01, 2018 2:02 pm, edited 1 time in total.
Re: Play sound on hotspot click?
I don't know if it will work with hotspot (as I never work with imagemap), but you can try the activate_sound property, giving a string with the sound file path and name.
As for jumping back to the screen, if you call that screen from a label, you can return to that label if you use Call action instead of jump, and at the end of the called label, put a return statement. It's a little hard to explain, but consider this example.
Code: Select all
hotspot (1119, 634, 139, 68) activate_sound "clicked.ogg" action Jump("home_frontyard") hovered ShowTransient("label_frontyard") unhovered Hide("label_frontyard")
Code: Select all
label start:
"Let's go to the beach."
call beach #We call the beach label here
"I have returned!" #We return here after the beach label finishes
return #This ends the game since there's no previous label to return to
label beach:
"The sea is beautiful."
# We could call the beach imagemap screen here
"Let's go back."
return #This goes back to right after the beach label was called
Re: Play sound on hotspot click?
Thank you so much. activate_sound on a hotspot does work. Originally I had multiple ways to enter a specific screen, some were through a door and others weren't, so my Jump to Label -> Jump to screen would play the door open sound no matter what, unless I had separate labels for each. This makes me completely not need to do that. Thanks!ReDZiX wrote: ↑Thu Mar 01, 2018 9:43 amI don't know if it will work with hotspot (as I never work with imagemap), but you can try the activate_sound property, giving a string with the sound file path and name.As for jumping back to the screen, if you call that screen from a label, you can return to that label if you use Call action instead of jump, and at the end of the called label, put a return statement. It's a little hard to explain, but consider this example.Code: Select all
hotspot (1119, 634, 139, 68) activate_sound "clicked.ogg" action Jump("home_frontyard") hovered ShowTransient("label_frontyard") unhovered Hide("label_frontyard")
Code: Select all
label start: "Let's go to the beach." call beach #We call the beach label here "I have returned!" #We return here after the beach label finishes return #This ends the game since there's no previous label to return to label beach: "The sea is beautiful." # We could call the beach imagemap screen here "Let's go back." return #This goes back to right after the beach label was called
Who is online
Users browsing this forum: No registered users