custom game menu transition / transition with transparency

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
User avatar
xiruo
Newbie
Posts: 8
Joined: Wed Nov 30, 2022 7:14 am
itch: no-xiruo
Contact:

custom game menu transition / transition with transparency

#1 Post by xiruo »

Hello! I've been looking around for a while to see if there have been any answers but I still don't know if this is possible.

Basically, what is happening is that I want to slide in this notebook for the game menu. Basically have it slide in over the current game screen.
Right now I'm using cropmove to make this transition happen.
The issue with this is that the background isn't transparent, it's a copy of the game background? It's hard to explain in text, but it looks like this around mid-transition.

I know that using a transform instead of a transition can help with this, but in the case of game menu transitions, if I were to add a transform to the game_menu it would play every time you clicked the navigation buttons. Also I don't know how you would add a transform for when you dismiss the game_menu in that case.

But most importantly, I believe that the config.enter_transition and config.exit_transition don't allow transforms. Which makes this really difficult.

Is there a way to get rid of this background on top of background overlap using only transitions?

By the way, the code I have right now for move in and move out game menu transitions:

Code: Select all

## Entering or exiting the game menu.
define menu_t_in = CropMove(1, "slideright")
define menu_t_out = CropMove(0.2, "slideawayright")

define config.enter_transition = menu_t_in
define config.exit_transition = menu_t_out
Thank you!
ᕕ( ᐛ )ᕗ ᕕ( ᐕ )ᕗ

User avatar
_ticlock_
Miko-Class Veteran
Posts: 910
Joined: Mon Oct 26, 2020 5:41 pm
Contact:

Re: custom game menu transition / transition with transparency

#2 Post by _ticlock_ »

xiruo wrote: Wed Nov 30, 2022 8:00 am
Transition changes old displayable to the new one. In your case:
old: game
new: game menu with game background
That is why you have the problem you described.

A possible workaround is to apply the transition to "screens" layer:

Code: Select all

define on_screen = { "screens" : slideright }
define off_screen = { "screens" : slideawayleft }

define config.enter_transition = on_screen
define config.exit_transition = off_screen
Note, that dialogue box is also on "screens" layer. So maybe it makes sense to combine with other transions, for example:

Code: Select all

define on_screen = { "screens" : MultipleTransition([False, Dissolve(0.2), "#0000", slideright, True]) }

User avatar
xiruo
Newbie
Posts: 8
Joined: Wed Nov 30, 2022 7:14 am
itch: no-xiruo
Contact:

Re: custom game menu transition / transition with transparency

#3 Post by xiruo »

Woah, thank you! This worked perfectly!

It didn't hit me that you could use the MultipleTransition transition to get around this, thank you!

The final code I ended up using, btw:
The default slideright/slideawayright were kinda slow so I added that change :>

Code: Select all

define on_screen = { "screens" : MultipleTransition([False, Dissolve(0.2), "#0000", CropMove(0.2, "slideright"), True]) }
define off_screen = { "screens" : MultipleTransition([False, CropMove(0.2, "slideawayright"), "#0000", Dissolve(0.2), True]) }

define config.enter_transition = on_screen
define config.exit_transition = off_screen
ᕕ( ᐛ )ᕗ ᕕ( ᐕ )ᕗ

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot