Map navigation with irregular 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
menostorpe
Newbie
Posts: 15
Joined: Tue Jan 06, 2009 10:01 am
Contact:

Map navigation with irregular hotspots?

#1 Post by menostorpe » Wed Nov 23, 2016 12:21 pm

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.

philat
Eileen-Class Veteran
Posts: 1763
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Map navigation with irregular hotspots?

#2 Post by philat » Wed Nov 23, 2016 10:29 pm

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.

User avatar
Kaen
Regular
Posts: 148
Joined: Tue Oct 16, 2012 10:49 pm
Contact:

Re: Map navigation with irregular hotspots?

#3 Post by Kaen » Thu Nov 24, 2016 10:18 am

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.

Post Reply

Who is online

Users browsing this forum: drbugs, Google [Bot], WillandBran