Imagebutton Instructions

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
galadain
Regular
Posts: 31
Joined: Wed Sep 09, 2020 4:24 pm
Contact:

Imagebutton Instructions

#1 Post by galadain » Wed Sep 30, 2020 12:03 pm

Can someone point me in the right direction for up-to-date instructions and/or tutorials for how to use Imagebuttons (or something similar if they aren't used anymore)? Everything I've found on the forums is at least a year or two old.

nananame
Regular
Posts: 72
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Re: Imagebutton Instructions

#2 Post by nananame » Wed Sep 30, 2020 12:14 pm

https://www.renpy.org/doc/html/screens.html#imagebutton

Still used, still quite simple.

You can do the auto thing but the simplest instruction is:

Code: Select all

imagebutton:
    idle "images/someimage.png" #this is the button
    pos (20,50) #this is the x,y position of the button
    action NullAction() #what happens when you click the button, this means nothing will happen

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

Re: Imagebutton Instructions

#3 Post by Imperf3kt » Wed Sep 30, 2020 3:36 pm

nananame wrote:
Wed Sep 30, 2020 12:14 pm
https://www.renpy.org/doc/html/screens.html#imagebutton

Still used, still quite simple.

You can do the auto thing but the simplest instruction is:

Code: Select all

imagebutton:
    idle "images/someimage.png" #this is the button
    pos (20,50) #this is the x,y position of the button
    action NullAction() #what happens when you click the button, this means nothing will happen
You need at least an idle and a hover image for imagebutton.

Though originally created in 2013 and updated in 2017, this post still shows how imagebuttons work.
viewtopic.php?f=51&t=22565&start=75#p455107
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

nananame
Regular
Posts: 72
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Re: Imagebutton Instructions

#4 Post by nananame » Thu Oct 08, 2020 4:08 am

Imperf3kt wrote:
Wed Sep 30, 2020 3:36 pm
You need at least an idle and a hover image for imagebutton.
hover is optional :)

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

Re: Imagebutton Instructions

#5 Post by Imperf3kt » Thu Oct 08, 2020 4:47 am

nananame wrote:
Thu Oct 08, 2020 4:08 am
Imperf3kt wrote:
Wed Sep 30, 2020 3:36 pm
You need at least an idle and a hover image for imagebutton.
hover is optional :)
Ah, you're right. I can't seem to find any mention of requiring both idle and hover in the official documentation or the tutorial game.

I think my confusion comes from https://fuckyeahrenpy.tumblr.com/post/9 ... -main-menu which I read about five years ago.
You MUST have “idle” and “hover” in the file names for the button images or else they will NOT work properly!
This only applies if you're using the "auto" property.

Carry on!
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

Post Reply

Who is online

Users browsing this forum: Google [Bot], TioNick