I wanted to change the background image for the main menu after the player gets to a certain part of the game, but I would also like for the image to change during different runthroughs.
So, it would be something like: The main menu has a default background. During the game, you could choose which character you wanted to play as. After you choose, the background image of the main menu is now that character. You finish the game, and then the main menu goes back to the default background.
Any help is greatly appreciated!
How to make main menu background image change?
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.
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: How to make main menu background image change?
Use a persistent variable to tell the main menu what background to use.
main menu is technically "outside" the game, so you need to use a persistent variable, they serve to have info shared among plays.
In screens.rpy, you need to change the main_menu screen to add your background.
main menu is technically "outside" the game, so you need to use a persistent variable, they serve to have info shared among plays.
Code: Select all
define persistent.main_menu_bg = "main_menu_bg_base"
label start:
" Prologue. background image of menu not changed"
menu:
"Batman?":
$ persistent.main_menu_bg = "main_menu_bg_batman"
"Now main menu shows a man with a bat costume."
jump batman_ending
"Superman?":
$ persistent.main_menu_bg = "main_menu_bg_superman"
"Now main menu shows a man with a cape."
jump superman_ending
# ...
label batman_ending:
$ persistent.main_menu_bg = "main_menu_bg_base"
"THE END. main menu background is back to normal."
return
label superman_ending:
$ persistent.main_menu_bg = "main_menu_bg_base"
"THE END. main menu background is back to normal."
return
Code: Select all
screen main_menu():
## This ensures that any other menu screen is replaced.
tag menu
style_prefix "main_menu"
add persistent.main_menu_bg # <-- CHANGE THIS LINE
# ... the screen continues...
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: How to make main menu background image change?
Ahh, thank you so much!
Who is online
Users browsing this forum: Andredron, Bing [Bot]