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.
-
Gigan
- Newbie
- Posts: 13
- Joined: Mon Jan 10, 2022 7:02 pm
-
Contact:
#1
Post
by Gigan » Sun Jun 19, 2022 2:19 pm
Hey there ! Been trying to solve that mess for the past 3 hours, I figured it would be much easier to ask here...
I have a screen with several imagebuttons. I'd like some text and a preview of the image to show up when the player hovers it.
I figured how the change the text for each imagebutton using tooltips, but I don't know how to make the image be a different one depending on which imagebutton the player is hovering over.
Here's my code for the 2 cards displayed on the example below :
Code: Select all
screen upgrade_cards():
tag menu
modal True
zorder 100
add "bg/bg_cards_upgrade.png"
$tooltip = GetTooltip()
if tooltip:
text "[tooltip]":
pos (995, 95)
size 25
font "fonts/BaksoSapi.otf"
color "#f8f7f7"
image "cardgame/kaeli_card.png": ### <=== I know this line is the problem. It's the closest I got from the result I want :(
pos (980, 260)
at custom_zoom_card
imagebutton: #carte kaeli
focus_mask True
xpos 180
ypos 71
idle "cardgame/ib_carte_ok.png"
action Jump ("carte_lee_upgrade")
tooltip "kaeli"
imagebutton: #carte Candice
focus_mask True
xpos 557
ypos 71
idle "cardgame/ib_carte_ok.png"
action Jump ("carte_candice_upgrade")
tooltip "Candice"
transform custom_zoom_card:
zoom 0.34
Thank in advance anyone !
Last edited by
Gigan on Sun Jun 19, 2022 3:20 pm, edited 1 time in total.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Sun Jun 19, 2022 3:14 pm
You can pass objects different form string to tooltip:
Code: Select all
$tooltip = GetTooltip()
if tooltip:
text tooltip[0]:
pos (995, 95)
size 25
font "fonts/BaksoSapi.otf"
color "#f8f7f7"
add tooltip[1]
pos (980, 260)
at custom_zoom_card
imagebutton: #carte kaeli
focus_mask True
xpos 180
ypos 71
idle "cardgame/ib_carte_ok.png"
action Jump ("carte_lee_upgrade")
tooltip ("kaeli", "cardgame/kaeli_card.png")
imagebutton: #carte Candice
focus_mask True
xpos 557
ypos 71
idle "cardgame/ib_carte_ok.png"
action Jump ("carte_candice_upgrade")
tooltip ("Candice", "cardgame/Candice_card.png")
< < insert Rick Cook quote here > >
-
Gigan
- Newbie
- Posts: 13
- Joined: Mon Jan 10, 2022 7:02 pm
-
Contact:
#3
Post
by Gigan » Sun Jun 19, 2022 3:19 pm
Works perfectly ! Thank you so much !

Users browsing this forum: Bing [Bot], Google [Bot], _ticlock_