Assign Action to g.button.make

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
imperator_runnybunny
Newbie
Posts: 4
Joined: Wed May 27, 2015 1:31 am
Contact:

Assign Action to g.button.make

#1 Post by imperator_runnybunny »

We are working on a Game for Renpy. It's almost finished but there's a problem with the gallery.
The following code (in the attachment) displays three Character Avatars, when i tap on them i want an action to start (in this case switch to another screen)

i tried to to the following:

add g.make_button("end2", "gui/win_thumb_0201_L.png", xalign=0.5, yalign=0.5) action ShowMenu('page5')

but it says "action is not a keyword argument or valid child for the add statement."

Does anyone know how to assign an action to this button?

Thank you in common.
Attachments
2015-05-27 07_29_37-screens.rpy - file___C__Users_EINKAUF-FSP_Google Drive_Gemeinsames Projekt 001_A.png

User avatar
kitsalai
Regular
Posts: 65
Joined: Wed Jan 08, 2014 11:05 pm
Projects: Imaginatum
Location: US
Contact:

Re: Assign Action to g.button.make

#2 Post by kitsalai »

The make_button() function of Gallery has a predefined action of displaying the image to the user. I don't think it's possible to change its action.

What you're looking for is an imagebutton (http://www.renpy.org/doc/html/screens.html#imagebutton) It functions similar to textbutton and you can assign your ShowMenu() action to it. I haven't tested it myself, but I'm sure you can figure it out.

imperator_runnybunny
Newbie
Posts: 4
Joined: Wed May 27, 2015 1:31 am
Contact:

Re: Assign Action to g.button.make

#3 Post by imperator_runnybunny »

kitsalai wrote:The make_button() function of Gallery has a predefined action of displaying the image to the user. I don't think it's possible to change its action.

What you're looking for is an imagebutton (http://www.renpy.org/doc/html/screens.html#imagebutton) It functions similar to textbutton and you can assign your ShowMenu() action to it. I haven't tested it myself, but I'm sure you can figure it out.
Thank you very much for clearing that up! I successfully switched to imagebuttons!

Post Reply

Who is online

Users browsing this forum: piinkpuddiin