Need assistance with imagemap

johannes89

Member
Game Developer
Mar 23, 2018
133
147
Hey guys i need some assistance im not sure what im doing wrong but when i try to make clickable areas on my game its giving me only one side and not the other side what am i doing wrong

result=renpy.imagemap("kitchen_idle.png","kitchen_hover.png",[(6,3,600,1078,"kitchen"),(1381,14,527,1078,"bathroom")])

if result == "kitchen":
e"i need to go to the kitchen"
if result == "shower":
e"i need to use the shower"

it only show the kitchen hover and not the bathroom can anyone perhaps help me out the kitchen and bathroom i did highlight in the kitchen_hover
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,971
16,226
result=renpy.imagemap("kitchen_idle.png","kitchen_hover.png",[(6,3,600,1078,"kitchen"),(1381,14,527,1078,"bathroom")])
Alright, stop right here. Where have you found this ? It's obsolete since like 7 years. Ren'py SDK come with a full, up to date, help that can be found in the doc folder where you put the said SDK, and can also be found . It's where you need to search first for information ; in your case, it's the page that you need to read first.

As for your particular question, the (old and now obsolete) documentation regarding renpy.imagemap is clear. The coordinates for the hotspot are top-left corner and bottom-right corner, while you used top-left corner, size of the zone. The error isn't obvious for the kitchen, because you don't see that you miss 6 pixels in width and 3 in height. But for the second hotspot it, naturally, break everything since you ask for a hotspot which would look like a rectangle twisted in its middle.
This said, anyway it's not how you should do it now. Use a screen and the imagemap Screen Language 2 statement (explanation in the page linked above).
 

HiEv

Member
Sep 1, 2017
384
785
Hey guys i need some assistance im not sure what im doing wrong but when i try to make clickable areas on my game its giving me only one side and not the other side what am i doing wrong

result=renpy.imagemap("kitchen_idle.png","kitchen_hover.png",[(6,3,600,1078,"kitchen"),(1381,14,527,1078,"bathroom")])

if result == "kitchen":
e"i need to go to the kitchen"
if result == "shower":
e"i need to use the shower"

it only show the kitchen hover and not the bathroom can anyone perhaps help me out the kitchen and bathroom i did highlight in the kitchen_hover
I'm no expert here, but is it because you called it "bathroom" in one part of the code, and "shower" in another?

(LOL. I posted nearly simultaneously with Anne's post above.)
 

johannes89

Member
Game Developer
Mar 23, 2018
133
147
Im still new in this coding in the code above i called bathroom and kitchen with two hotspots where it was suppose to redirect to so if i click on kitchen it does go to kitchen im trying to make a map future where i can go from bedroom to kitchen bathroom and livingroom but cant get it right at all
 

krzysiek

Newbie
Game Developer
Oct 10, 2017
41
32
I'd do it like that, cos I like imagebuttons :)
Prepare 2 pics in photoshop:
1 transparent (check resolution, make picture, which is 1/3 part of your whole "kitchen". )
2 same size as first picture, but with highlight.

Example Code:

screen goto:
imagebutton idle "transparent.png" hover "yellow_highlight.png" xpos 0.0 ypos 0.0 focus_mask True Jump("kitchen")
imagebutton idle "transparent.png" hover "yellow_highlight.png" xpos 0.7 ypos 0.0 focus_mask True Jump("bathroom")

lable start:
scene "kitchen.png"
call screen goto

label kitchen:
e "i need to go to the kitchen"

label bathroom:
e "i need to use the shower"

When you hover left side of the image, you'll see yellow highlight and after click, you jump to label kitchen. Same with the right side.
It's important to prepare images and corectly put them on the screen.
I hope you'll understand me.