- Dec 22, 2020
- 7
- 43
Hello there, I'm trying to use tooltips on my map with a little overlay bar behind the text with custom coordinates depending on the imagebutton position and the image size used.
But I can't get it to work as I probably misplaced and misused variables for still being very new to renpy.
That's what it looks like right now
And I want it to look like this
The way I was trying to accomplish this, was by setting x and y values inside each imagebutton with "hovered" "SetVariable".
Of course it'd be way more elegant to actually read out the individual image sizes to determine the offset of the tooltip, but I
don't know how to do that either.
This is what my current code in screens.rpy looks like.
screen gameUI:
imagebutton:
xalign 0.5
yalign 0.0
yoffset 30
auto "places/map/mapbutton_%s.png"
action ShowMenu("mapUI")
screen mapUI():
add "places/map/citymap.jpg"
$ tooltip = GetTooltip()
$ ttxpos = 0
$ ttypos = 0
#Bar/Nightclub
imagebutton:
xpos 1257
ypos 58
auto "places/map/mm/bar_%s.png"
focus_mask True
hovered SetVariable("ttxpos", 1317), SetVariable("ttypos", 121)
tooltip "Bar"
action NullAction()
...
if tooltip:
add "places/map/map_tooltipbar.png" xpos ttxpos ypos ttypos
text "{size=32}{color=#222222}[tooltip]{/color=#222222}{/size=32}" xalign 0.5 yalign 1.0
Thank you guys very much in advance!
But I can't get it to work as I probably misplaced and misused variables for still being very new to renpy.
That's what it looks like right now
And I want it to look like this
The way I was trying to accomplish this, was by setting x and y values inside each imagebutton with "hovered" "SetVariable".
Of course it'd be way more elegant to actually read out the individual image sizes to determine the offset of the tooltip, but I
don't know how to do that either.
This is what my current code in screens.rpy looks like.
screen gameUI:
imagebutton:
xalign 0.5
yalign 0.0
yoffset 30
auto "places/map/mapbutton_%s.png"
action ShowMenu("mapUI")
screen mapUI():
add "places/map/citymap.jpg"
$ tooltip = GetTooltip()
$ ttxpos = 0
$ ttypos = 0
#Bar/Nightclub
imagebutton:
xpos 1257
ypos 58
auto "places/map/mm/bar_%s.png"
focus_mask True
hovered SetVariable("ttxpos", 1317), SetVariable("ttypos", 121)
tooltip "Bar"
action NullAction()
...
if tooltip:
add "places/map/map_tooltipbar.png" xpos ttxpos ypos ttypos
text "{size=32}{color=#222222}[tooltip]{/color=#222222}{/size=32}" xalign 0.5 yalign 1.0
Thank you guys very much in advance!