Page 1 of 1

Yes/No Prompt Woes (Solved!)

Posted: Thu Oct 16, 2014 10:32 pm
by sasquatchii
Hi! So today I finally figured out how to customize the "Are you sure you want to quit?" menu in my game. It's pretty simple looking, but it is just a transparent bubble that appears over whatever background image is present.

Here's what it looks like in the main menu.

And in game with place holder bg/sprites.

But in the main menu, this is what appears if you hit the X in the top right of the window, instead of hitting the quit button within renpy.

What I'd like to happen if the player hits the x button in the main menu would be for them to see the same thing that they'd see in the first link. It doesn't do this when the game has started, or on any other screen, only the main menu.

Here is the code I'm using to do this:

Code: Select all

screen yesno_prompt(message, yes_action, no_action):

    #modal True
    
    add "images/gui/yesnobg.png"

    imagemap:
        ground 'images/gui/yesno_ground.png'
        idle 'images/gui/yesno_idle.png' 
        hover 'images/gui/yesno_hover.png'
        
        
        hotspot (795,628,100,48) action yes_action
        hotspot (1064,628,86,48) action no_action

  

    if message == layout.ARE_YOU_SURE:
        add "images/gui/yesno_are_you_sure.png"
        
    elif message == layout.DELETE_SAVE:
        add "images/gui/yesno_delete_save.png"
        
    elif message == layout.OVERWRITE_SAVE:
        add "images/gui/yesno_overwrite_save.png"
        
    elif message == layout.LOADING:
        add "images/gui/yesno_loading.png"
        
    elif message == layout.QUIT:
        add "images/gui/yesno_quit.png"
        
    elif message == layout.MAIN_MENU:
        add "images/gui/yesno_main_menu.png" 
If anyone has any ideas or suggestions to fix this, I would greatly appreciate it! Thank you for reading.

Re: Yes/No Prompt with transparent background causing proble

Posted: Fri Oct 17, 2014 11:06 pm
by yuucie
I had this same problem before too. Here's the solution I was given:

Add the extra line under layout.QUIT (replace the png images with your own). My background.png included the yes-no thing pasted on it, so you may have to add extra lines to add your yesno image.

Code: Select all

    elif message == layout.QUIT:
        add "UI/yesno-ground.png"
        if main_menu:
            add "background.png"

Re: Yes/No Prompt with transparent background causing proble

Posted: Sun Oct 19, 2014 9:09 pm
by sasquatchii
Thank you yuucie!! This TOTALLY WORKED!

I love how coding can make me feel like a genuis and a dummy simultaneously! I would have never figured that out if you hadn't posted that. Thanks again!

Re: Yes/No Prompt with transparent background causing proble

Posted: Mon Oct 20, 2014 10:59 am
by OokamiKasumi
yuucie wrote:I had this same problem before too. Here's the solution I was given:

Add the extra line under layout.QUIT (replace the png images with your own). My background.png included the yes-no thing pasted on it, so you may have to add extra lines to add your yesno image.

Code: Select all

    elif message == layout.QUIT:
        add "UI/yesno-ground.png"
        if main_menu:
            add "background.png"
Oh! Thank you!
-- I didn't have this in my backgrounds tutorial because I normally use full-screen jpgs for my backgrounds. With all due respect, I have added it to the tutorial.