How to create "invisible" imagebuttons or hotspots?

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
unregistered
Newbie
Posts: 17
Joined: Tue Apr 21, 2020 5:18 am
Contact:

How to create "invisible" imagebuttons or hotspots?

#1 Post by unregistered »

I'm searching for a way to include invisible hotspots or imagebuttons to a screen or an imagemap.

Currently, I use the regular hotspot function from imagemaps. However, these hotspots take the graphics from the ground, idle or hover images. The screens have random animations added to them, so these hotspot areas are static and as soon as an animation goes behind the hotspot area, it disappears because the imagemap always puts itself in front when there's a hotspot defined.

The code I have the problem with is really just a typical:

Code: Select all

hotspot (0,0,200,1097) action Jump("{somelable}") {some style parameters}
Is there a way to create a hotspot area or clickable mousearea over the screen that is just invisible and does not interfere with what is drawn on the screen? I don't need hover states or anything, just a rectangular area and a click action.

The only way I found this to work is using images with empty alpha planes and with the correct size and use them as imagebuttons on the correct position. But I have many hotspots (way over 100) and I think there must be a better way then filling up my projects with useless files. I could probably also define imagebutton images with ATL, but that would mean I need an image definition for every of these hundreds of hotspots. It would also be great if I wouldn't have to change the code so much and probably there's some style argument for a hotspot that could fix that.

Any ideas?

unregistered
Newbie
Posts: 17
Joined: Tue Apr 21, 2020 5:18 am
Contact:

Re: How to create "invisible" imagebuttons or hotspots?

#2 Post by unregistered »

Sometimes you find a possible answer just when you posted a question:

I just realized I can put a transform to a hotspot with "at". When the transform has full alpha, the hotspot is invisible. I think that should be it:

Code: Select all

transform fullalpha:
    alpha 0.0

Code: Select all

hotspot (0,0,200,1097) action {...} at fullalpha
This makes everything from the hotspot invisible, including hover states.

I'll leave this in here just in case somebody wondered (or in case I missed something, then I might add a post).

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1023
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: How to create "invisible" imagebuttons or hotspots?

#3 Post by m_from_space »

Just use a normal button and place it somewhere. Buttons don't take any parameters and are just invisible areas to interact with, if you don't give them some color or whatever.

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

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], eleloyce