Hiding and showing buttons

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
MisterHarold
Regular
Posts: 51
Joined: Tue Jul 17, 2018 10:32 am
Location: Philippines
Contact:

Hiding and showing buttons

#1 Post by MisterHarold »

Hello. I want to ask how I can hide an image button by pressing it and showing another image button. I will implement this on my main menu. Instead of transitioning from screen to screen, I just want to be able to show or hide buttons. Any help would be greatly appreciated.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: Hiding and showing buttons

#2 Post by Kia »

you need a variable and some "if"

default hidebtn = 1

Code: Select all

if hidbtn:
    button:
        text "1st"
        action SetScreenVariable("hidbtn", 0)
else:
    button:
        text "2nd"
        action SetScreenVariable("hidbtn", 1)
I didn't test this code, might contain mistakes

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3794
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Hiding and showing buttons

#3 Post by Imperf3kt »

This seems unnecessarily complicated, are you sure you want to do this?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Post Reply

Who is online

Users browsing this forum: No registered users