Transparency on the main menu.

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
qadia
Newbie
Posts: 2
Joined: Mon Oct 04, 2010 8:45 pm
Contact:

Transparency on the main menu.

#1 Post by qadia »

Good evening ~
I made my main menu customization with the Main Menu Generator, and my code looks like this:

Code: Select all

label main_menu:
    $ ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
    $ ui.window(style='mm_root', background='menu.jpg')
    $ ui.imagebutton('start.jpg', 'starth.jpg',clicked=ui.jumpsoutofcontext('start'),xanchor=.5, yanchor=.5, xpos=341,ypos=257,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav ')
    $ ui.imagebutton('continue.jpg','continueh.jpg',clicked=_intra_jumps('load_screen', 'main_game_transition'), xpos=341,ypos=289,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('preferences.jpg','preferencesh.jpg',clicked=_intra_jumps('preferences_screen', 'main_game_transition'), xpos=342,ypos=320,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('quit.jpg','quith.jpg',clicked=ui.jumps('_quit'), xpos=341,ypos=385,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ renpy.music.play('menu.wav', fadein=2)
    $ ui.interact(suppress_overlay=True, suppress_underlay=True, mouse='mainmenu')
  
It works perfectly fine, and I'm very happy with it. However, I also wanted to add snowblossom effect to it. I did a little research and came up with this:

Code: Select all

init:
    image snowblossom = SnowBlossom("blossom.png")
label main_menu:
    show snowblossom
, and this:

Code: Select all

mm_root=Fixed(
        Image("menu.jpg"),
        SnowBlossom("blossom.png", count=10, xspeed=(10, 30), yspeed=(50, 70), start=7)),
and added those to my game. It didn't work out. I decided to give up on the snowblossom thing and started customizing my game menus. However, I wanted those to have transparency. They look fine on the game's screen, but on the main menu, the transparency is ignored, and the parts that were supposed to be transparent look black (and if I add snowblossom, it also has the particle motion). Those two problems are probably related then, I guess.

I really want to know what's going on, as I want to use my game menus, my main menu and also want to add snowblossom to the latter.

It sounds really confusing, I'm sorry if it's hard to understand. And I'm also sorry if I'm missing something terribly stupid (which I probably am), but those details are really getting to my nerves and I don't know who else to turn to.

Thank you, and please bear with me ~

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: Transparency on the main menu.

#2 Post by Aleema »

To add your SnowBlossom, you'll need to add it to the label main_menu code, not the mm_root code.

Set up your effect in an init block:
$ my_blossoms = SnowBlossom("blossom.png", count=10, xspeed=(10, 30), yspeed=(50, 70), start=7)

Go to your main_menu label and insert it here:

Code: Select all

label main_menu:
    $ ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
    $ ui.window(style='mm_root', background='menu.jpg')
    $ ui.imagebutton('start.jpg', 'starth.jpg',clicked=ui.jumpsoutofcontext('start'),xanchor=.5, yanchor=.5, xpos=341,ypos=257,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav ')
    $ ui.imagebutton('continue.jpg','continueh.jpg',clicked=_intra_jumps('load_screen', 'main_game_transition'), xpos=341,ypos=289,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('preferences.jpg','preferencesh.jpg',clicked=_intra_jumps('preferences_screen', 'main_game_transition'), xpos=342,ypos=320,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('quit.jpg','quith.jpg',clicked=ui.jumps('_quit'), xpos=341,ypos=385,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ renpy.music.play('menu.wav', fadein=2)
    
    show my_blossoms
    
    $ ui.interact(suppress_overlay=True, suppress_underlay=True, mouse='mainmenu')
Put anything you want to add to the design BEFORE the ui.interact. I haven't tested that, but since you're not in python, it should work. O_o

As for your transparency issue, can you post the images you are using? And the code?

qadia
Newbie
Posts: 2
Joined: Mon Oct 04, 2010 8:45 pm
Contact:

Re: Transparency on the main menu.

#3 Post by qadia »

Thank you so much for answering! ~

Umm, the snowblossom thing didn't work out. Am I doing something stupid? TT'

Code: Select all

init:
   $ my_blossoms = SnowBlossom("blossom.png", count=10, xspeed=(10, 30), yspeed=(50, 70), start=7)

label main_menu:
    $ ui.add(renpy.Keymap(toggle_fullscreen = renpy.toggle_fullscreen))
    $ ui.window(style='mm_root', background='menu.jpg')
    $ ui.imagebutton('start.jpg', 'starth.jpg',clicked=ui.jumpsoutofcontext('start'),xanchor=.5, yanchor=.5, xpos=341,ypos=257,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav ')
    $ ui.imagebutton('continue.jpg','continueh.jpg',clicked=_intra_jumps('load_screen', 'main_game_transition'), xpos=341,ypos=289,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('preferences.jpg','preferencesh.jpg',clicked=_intra_jumps('preferences_screen', 'main_game_transition'), xpos=342,ypos=320,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ ui.imagebutton('quit.jpg','quith.jpg',clicked=ui.jumps('_quit'), xpos=341,ypos=385,xminimum=155,yminimum=10,hover_sound='None', activate_sound='click.wav',xanchor=.5, yanchor=.5 )
    $ renpy.music.play('menu.wav', fadein=2)
    
    show my_blossoms
    
    $ ui.interact(suppress_overlay=True, suppress_underlay=True, mouse='mainmenu')
    
I haven't really finished my game menus yet, but here's an example for the navigation:

Code: Select all

init -2 python:
    layout.imagemap_navigation(
        "gm.png",
        "gm.png",
        "gm.png",
        "gm.png",
        "gm.png",
        [
            (120, 150, 350, 180, "Return"),
            (120, 200, 350, 250, "Save Game"),
            (120, 250, 350, 300, "Load Game"),
            (120, 300, 350, 350, "Main Menu"),
            (120, 350, 350, 400, "Preferences"),
            (120, 400, 350, 450, "Quit"),
            ])
and,

Code: Select all

gm_root = "blank.png",
Here's what it looks like:
Image

It works just fine during the game. But when on the main menu, it looks like this:

Image

What do I do? TT' ~

Thank you ~

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]