Page 1 of 1

Map navigation with irregular hotspots?

Posted: Wed Nov 23, 2016 12:21 pm
by menostorpe
What I'm trying to do is create a screen where players can navigate to different parts of a town visually. It doesn't need any special features beyond what can be found in an imagemap, but the problem is that, as I understand it, hotspots can only be defined as rectangles. The image is a complex one with buildings partially overlapping, so defining those as rectangles will always look wrong, especially with the highlighting when hovering over a building.

My second thought was to chop the image up into many different imagebuttons. This seems to work in theory, but it turns making the navigation screen into an ugly and tedious jigsaw puzzle. I'm not very familiar with imagebuttons, though, I just tried to work it out with tutorials starting yesterday.

Am I missing a feature or fundamentally misunderstanding something here? Are there any alternative ways to do this? I've tried to search tutorials and threads for more on this, but please do link me if I missed something that already covers the subject.

Re: Map navigation with irregular hotspots?

Posted: Wed Nov 23, 2016 10:29 pm
by philat
Hmm. If not for overlapping, I'd say use a transparent hover image with only the hoverable objects being opaque and alpha set to true (which it is by default) -- that way, regardless of the hotspot being rectangular, it will only trigger on the opaque parts. But if there's overlapping, this becomes more difficult. There's really no way around it, though, as Renpy doesn't support polygonal hotspots. As you mentioned, you can use imagebuttons if absolutely necessary.

Re: Map navigation with irregular hotspots?

Posted: Thu Nov 24, 2016 10:18 am
by Kaen
You can easily do this using imagebuttons.

Take a look at the docs for more info about how to use them: https://www.renpy.org/doc/html/screens.html#imagebutton

Ah, don't forget to use focus_mask True property so only non-transparent part of the image will trigger the button.