Making a Vbox into a button?

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
User avatar
dartbored
Newbie
Posts: 7
Joined: Sat Sep 08, 2018 12:56 pm
Projects: Project Codename: Headspace
Contact:

Making a Vbox into a button?

#1 Post by dartbored » Sun Nov 03, 2019 9:56 pm

Is there a way for me to use a vbox like a button to execute a screen action such as Jump()?

I have this box of profile data for each character, and I want the player to be able to click anywhere on a profile to jump to a label
"No, no. You're my brother, Ethan."

"Your talking robot brother?"

"Affirmative."

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

Re: Making a Vbox into a button?

#2 Post by Imperf3kt » Sun Nov 03, 2019 10:19 pm

You could do that. I can think of two ways (neither tested)

The easiest would be to place a regular button inside the vbox, that is the same size as the vbox, over the top of everything else. Or inside a fixed placed above the vbox in the same position.
Obviously make the button invisible so it can be seen through, but not clicked through.

The second, more elegant solution would be to place the contents of the vbox, inside the button instead.
This however, is much more complicated and boasts no real benefits, so I'd just go with the first option for simplicity.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

strayerror
Regular
Posts: 154
Joined: Fri Jan 04, 2019 3:44 pm
Contact:

Re: Making a Vbox into a button?

#3 Post by strayerror » Sun Nov 03, 2019 11:59 pm

You should just be able to replace:

Code: Select all

vbox:
    [sub items and styles]
with

Code: Select all

button:
    action Jump('your_label')
    has vbox
    [sub items and styles]

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]