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.
So i trying to make an imagebutton for location mover. Player click on door and go inside in hallway. Button working fine, but whole screen became button, not just door. Hovered picture done in photoshop. I just deleted all except door and saved as png. Can you pls help? What am i doing wrong?
Well, yes. Whole displayable you use to create imagebutton becomes clickable. Because you didn't pass any information on what areas should be clickable. Eou want to cut all your images to size of your imagebutton and position it correctly to make it work like you want.
Strictly speaking you can make same areas of your idle image transparent and use focus_mask True but I advise against it.
Psion wrote: ↑Thu Apr 22, 2021 12:19 pm
picture blink when i move mouse.
Well, yes. If you didn't change your source image that how it should be. First you move cursor over idle image. As you explicitely told that this whole area is your button, if reacts. Now it is hovered, so image changes. As you explicitely told that everything non-transparent is a button, and your cursor is over transparent part of the image, it consider cursor to not be on button anymore. So it changes to idle image. Back to step 1.
You have several possibilities.
1) Crop your images to correct size and position your button where you want.
2) Do not cut original images. Do it inside RenPy using image manipulators ( i.e. Crop() )
3) Do not cut original images. Instead, make idle image transparent in the same places you hover image is transparent and use focus_mask True
4) Do not cut original images. Create a function which would detect if cursor is over desired area and use focus_mask with it.
This is imagemap, not imagebutton. Works slightly differently, with its own set of quirks. There should be a bunch of hotspots after snippet you posted.
I had problems, if several buttons have images which overlaps, it could lead to problems with some buttons being "hidden" by others. focus_mask is made to allow for things like circular buttons, not as substitution for cropping your image.