Hi, how do I prevent an imagebutton to activate if an image is in front of it on screen? At the moment, I can click on the image and it'll still trigger the imagebutton when I don't want it to.
Thanks
[SOLVED] How to prevent imagebutton to be clicked when an image is in front of it?
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.
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.
- GeeSeki
- Regular
- Posts: 112
- Joined: Sat Dec 17, 2016 3:39 am
- Projects: A Town Uncovered
- itch: geeseki
- Contact:
[SOLVED] How to prevent imagebutton to be clicked when an image is in front of it?
Last edited by GeeSeki on Thu Jan 13, 2022 8:52 pm, edited 2 times in total.
- GeeSeki
- Regular
- Posts: 112
- Joined: Sat Dec 17, 2016 3:39 am
- Projects: A Town Uncovered
- itch: geeseki
- Contact:
Re: How to prevent imagebutton to be clicked when an image is in front of it?
I found a work-around.
I have a the 'black' background as a btn at alpha 0.01 so that the player can trigger an action by pressing anywhere on the screen as well as not have it be visible.
I replaced the image with an image btn version of it and have the action show the same screen that it's on so it appears as if nothing has happened and it doesn't trigger the black image button
If there's a more effective workaround, let me (or others) know but this works.
I have a the 'black' background as a btn at alpha 0.01 so that the player can trigger an action by pressing anywhere on the screen as well as not have it be visible.
I replaced the image with an image btn version of it and have the action show the same screen that it's on so it appears as if nothing has happened and it doesn't trigger the black image button
If there's a more effective workaround, let me (or others) know but this works.
Code: Select all
imagebutton auto "btn black_%s" xpos 0 ypos 0 focus_mask True action [
Play("sound","audio/sfx/ReportPadClose2.ogg"),
SetVariable("report_is_pressed",0),
Hide("scr_reportpad_house", transition=Dissolve(0.05)),
Show("scr_reportpad_house_close")]
imagebutton auto "btn reportpad_house_prevent_%s" xpos 0 ypos 0 focus_mask True action Show("scr_reportpad_house")
# add "images/border/img_reportpad.png" xpos 0 ypos 300
Who is online
Users browsing this forum: apocolocyntose, Google [Bot]