Ren'Py Image buttons for character interactions

lydcreations

Member
Game Developer
May 6, 2019
304
405
I'm trying to determine how to code character interactions in Renpy using image buttons. I show image buttons options such as gift, compliment, and talk for the player to click to choose from. The gift image button would hide the previous image buttons and show new image buttons for the player to choose from. This would lead to text and a coding check to determine if the player has the gift item, etc. Compliment I imagine would reference a list of compliments and show one from the list. Talk would show new image buttons with topics such as art, books, etc. and dialogue based on said topic.

I can show the image buttons for the first level of interaction with the gift, compliment, and talk options. I've used calling the image buttons so that only the image button is clickable. But I haven't been able to figure out how to hide these image buttons so that I can replace them with the next ones such as the gift choices for example. I've used the following code to show the next image button:

Code:
screen main():
    vbox xalign 0.20 yalign 0.62:
        imagebutton:
                idle "gui/lincy.png"
                hover "gui/lincy_hl.png"
                action Show( "invent2" )


screen invent2():
    vbox xalign 0.20 yalign 0.62:
        imagebutton:
                idle "gui/kiss2.png"
                hover "gui/kiss2_hl.png"
                action NullAction()
Clearly this doesn't work very well as I haven't used screens very much. I haven't had any luck finding similar examples of coding to see how it should be done. Perhaps I wasn't using the correct search terms? Thanks in advance.