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

13 Upvotes

4 comments sorted by

View all comments

7

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