Scene Gallery - Using CG Gallery behavior as Scene Selector
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.
Scene Gallery - Using CG Gallery behavior as Scene Selector
Instead of a plain menu scene selector / selection, I would like to use the standard layout of the CG Gallery as the scene selector.
Basically, a representative image of the scene will be the image displayed as a thumbnail in the gallery...it doesn't have to be the first image in the scene. When you click on the thumbnail, however, instead of displaying a CG, the scene plays just like a regular jump in the game.
A scene is unlocked once you finished playing its duration -- a persistent variable is triggered that will make it available in the 'Scene Gallery'. The reason for this behavior is because it will be very useful for ero games where the player would rather go through the whole story at once and leave the sex scenes for enjoyment at a later time. This way, ero scenes can be unlocked even if they aren't displayed during the course of the main game. But I assume this kind of behavior will also prove useful for non-ero games in the form of unlocking special side stories. Currently side stories are unlocked as extras using standard menus.
But using the CG Gallery layout for scene unlocking will give the player a better scope of how much stuff there is in the game.
Would be helpful if there is specific code to use -- I would experiment with it but it won't hurt to ask. Thanks.
Basically, a representative image of the scene will be the image displayed as a thumbnail in the gallery...it doesn't have to be the first image in the scene. When you click on the thumbnail, however, instead of displaying a CG, the scene plays just like a regular jump in the game.
A scene is unlocked once you finished playing its duration -- a persistent variable is triggered that will make it available in the 'Scene Gallery'. The reason for this behavior is because it will be very useful for ero games where the player would rather go through the whole story at once and leave the sex scenes for enjoyment at a later time. This way, ero scenes can be unlocked even if they aren't displayed during the course of the main game. But I assume this kind of behavior will also prove useful for non-ero games in the form of unlocking special side stories. Currently side stories are unlocked as extras using standard menus.
But using the CG Gallery layout for scene unlocking will give the player a better scope of how much stuff there is in the game.
Would be helpful if there is specific code to use -- I would experiment with it but it won't hurt to ask. Thanks.
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
Ok, I have a specific request. Appreciate it if anyone can post code.
I just need a game menu that has 4 scenes to select, arranged on a 2 x 2 grid, a background with 4 thumbnails. I haven't used ui.interact but I think that would be the way to go about it in this case.
I just need a game menu that has 4 scenes to select, arranged on a 2 x 2 grid, a background with 4 thumbnails. I haven't used ui.interact but I think that would be the way to go about it in this case.
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
Basically, what you want is to use ui.imagebutton, perhaps along with ui.image for locked scenes.
Code: Select all
python:
if persistent.unlocked_scene_1:
ui.imagebutton("s1_idle.png", "s1_hover.png", clicked=ui.jumps('scene_1'), xpos=100, ypos=100)
else:
ui.image('s_locked.png', xpos=100, ypos=100)
# Repeat code for the other three images/scenes, changing xpos and ypos.
ui.interact()
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
Thanks, I'll experiment with it.
I just realized imagemaps might do the trick but having an imagemap for all the permutations of locked / unlocked scene combinations might be a nightmare to juggle.
I just realized imagemaps might do the trick but having an imagemap for all the permutations of locked / unlocked scene combinations might be a nightmare to juggle.
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
I really wish people forgot about imagemaps It might be the easiest concept to start with but it's a pain to make anything slightly complex to work with it ^^;... In your case, imagebuttons and image will work perfectly. You could also use ui.grid to have things neatly arranged in a grid :
You might need to position the grid itself, unless you put it in a frame or window which you can also position at your convenience
Code: Select all
python:
ui.grid(2,2)
if persistent.unlocked_scene_1:
ui.imagebutton("s1_idle.png", "s1_hover.png", clicked=ui.jumps('scene_1'))
else:
ui.image('s_locked.png', xpos=100, ypos=100)
# Repeat code for the other three images/scenes (no need to position anything)
ui.close()
ui.interact()
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
I only got to tinker with this recently, and I admit I still don't have a clue. Even for a simple 1x1 grid... how does one invoke this--as a new game menu?
Is there more to it than a simple copy paste to the options.rpy as well as appending a jump menu? Whats the difference between a menu jump to a regular vn scene versus a menu jump to a game / preferences screen?
Is there more to it than a simple copy paste to the options.rpy as well as appending a jump menu? Whats the difference between a menu jump to a regular vn scene versus a menu jump to a game / preferences screen?
-
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
http://www.renpy.org/wiki/renpy/doc/ref ... Game_MenusI only got to tinker with this recently, and I admit I still don't have a clue. Even for a simple 1x1 grid... how does one invoke this--as a new game menu?Is there more to it than a simple copy paste to the options.rpy as well as appending a jump menu?
I think this might help...
Regular to regular jump is the same as a menu to menu jump.Whats the difference between a menu jump to a regular vn scene versus a menu jump to a game / preferences screen?
Regular to menu jump however is a jumpoutofcontext and so menu to regular is a return.
What is a jump out of context? I have no idea.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
- PyTom
- Ren'Py Creator
- Posts: 16096
- 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:
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
Actually, this is wrong.JQuartz wrote:Regular to regular jump is the same as a menu to menu jump.
Regular to menu jump however is a jumpoutofcontext and so menu to regular is a return.
What is a jump out of context? I have no idea.
First, let me explain what contexts are. Contexts exist for two reasons:
1) To let python code invoke Ren'Py code.
2) To ensure we leave a menu when we load a game.
Something to note is that interactions take place in python code, rather than Ren'Py code. So if you want to be able to go to the game menu in the middle of an interaction, and then come back to the exact same place, you need to go to the game menu in a new context.
There are two "levels" of context in a Ren'Py game. The "main" context is where the game itself runs, while the "menu" context is where the main and game menus live.
Control is automatically sent to the menu context when the main menu is reached (at the end of the splashscreen, which runs in the default context). We can also go to the menu context by right clicking to invoke the game menu. Finally, you can go to the game menu using renpy.call_in_new_context and the _game_menu_save, _game_menu_load, or _game_menu_preferences labels. For example:
Code: Select all
# Big battle coming up, why not prompt the user to save?
$ renpy.call_in_new_context("_game_menu_save")
You can also do a jumpsoutofcontext, which takes a label. This brings you back to the main context, but jumps to a label rather than the point where you came from. This lets you do things like invoke the gallery (which runs in the main context) from the main menu.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
-
- Eileen-Class Veteran
- Posts: 1265
- Joined: Fri Aug 31, 2007 7:02 am
- Projects: 0 completed game. Still haven't made any meaningfully completed games...
- Contact:
Re: Scene Gallery - Using CG Gallery behavior as Scene Selector
I see, so it's a call in new context. Sorry.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.
Who is online
Users browsing this forum: Majestic-12 [Bot]