When a button clicked, it hides a button itself [SOLVED]

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
LabaroDD
Regular
Posts: 34
Joined: Thu Apr 14, 2016 7:47 am
Contact:

When a button clicked, it hides a button itself [SOLVED]

#1 Post by LabaroDD »

Hello everyone!
I need a help. I want the textbutton, that could hide itself with ATL, when it's pressed. I think it should be simple, but I can't imagine how to do this...
Any help will be very appreciated!
Last edited by LabaroDD on Sun Feb 19, 2017 9:25 am, edited 1 time in total.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2417
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: When a button clicked, it hides a button itself

#2 Post by Ocelot »

Create a screen containing your button:

Code: Select all

screen button_example:
    textbutton "TEST" action Hide(button_example'')
< < insert Rick Cook quote here > >

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: When a button clicked, it hides a button itself

#3 Post by xavimat »

To add ATL effect in showing and hiding, create a transform:

Code: Select all

transform hiding:
    alpha 0.0 yoffset -500
    easein 1.0 alpha 1.0 yoffset 0
    on hide:
        easeout 1.0 alpha 0.0 yoffset -500

screen button_example():
    textbutton "TEST" action Hide('button_example') at hiding
(There is a small typo in Ocelot's answer, the quotes)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

LabaroDD
Regular
Posts: 34
Joined: Thu Apr 14, 2016 7:47 am
Contact:

Re: When a button clicked, it hides a button itself

#4 Post by LabaroDD »

Thank you so much!
I thought here is the way to make it without screens, but I'm satisfied with this way too. ^^

Post Reply

Who is online

Users browsing this forum: Semrush [Bot]