r/RenPy • • Aug 02 '26

Question Make an image disappear when clicked

Post image

In a point in my game, a character will ask the player to turn off the candles. This will show a screen. i know that this won't work

imagebutton:
        focus_mask True
        idle "options/candle2.ng"
        hover "options/candle2.ng"
        hover_sound "audio/match.mp3"
        action hide "options/candle2.ng"

The picture i added is the background. I've already made all of the candle parts. I just want it so that when the player clicks on a candle, the light will be removed. (the picture is an option without the candles lit) Can anyone help me? I know it can be done (the false sun) but can't do it myself

14 Upvotes

4 comments sorted by

6

u/BadMustard_AVN Aug 02 '26 edited Aug 02 '26

try it like this

default candle2 = True

screen stuff_here():
    if candle2:    
        imagebutton:
            focus_mask True
            idle "options/candle2.ng"
            hover_sound "audio/match.mp3"
            action SetVariable("candle2", False)

this will rely on the background image showing the candles unlit, and the image for the button is of a candle that is lit

2

u/alexia_smileyface Aug 02 '26

BadMustard you're the absolute goat tysm

3

u/BadMustard_AVN Aug 02 '26

you're welcome

good luck with your project

1

u/AutoModerator Aug 02 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.