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.
Andy_kl
Newbie
Posts: 18 Joined: Sun Apr 09, 2017 12:00 pm
Contact:
#1
Post
by Andy_kl » Tue Jun 20, 2017 9:44 am
How to set a drag object to be a hover is frame but idle is image.
Code: Select all
screen inv_item(item, pos, choice_func):
drag:
drag_name item.name
child "images/inv_items/"+item.picture+".png"
droppable False
if choice_func == "drag_chest":
dragged dragged_chest
elif choice_func:
dragged dragged_local
else:
dragged dragged_on_screen
drag_raise True
pos pos
Last edited by
Andy_kl on Tue Jun 20, 2017 5:42 pm, edited 1 time in total.
Andy_kl
Newbie
Posts: 18 Joined: Sun Apr 09, 2017 12:00 pm
Contact:
#2
Post
by Andy_kl » Tue Jun 20, 2017 5:41 pm
I found a solution, but I think it's crooked
Code: Select all
screen inv_tooltip(item, pos):
zorder 51
frame:
xpos pos[0]+60
ypos pos[1]+120
xanchor 0.5
yanchor 0.0
background Solid("000")
vbox:
grid 2 1:
spacing 5
label "[item.caption]"
label "[item.info]"
init python:
def hide_inv_tooltip():
if renpy.display.focus.get_grab():
if renpy.get_screen("inv_tooltip"):
renpy.hide_screen("inv_tooltip")
renpy.restart_interaction()
return
config.periodic_callback = hide_inv_tooltip
screen inv_item(item, pos, choice_func):
drag:
drag_name item.name
child "images/inv_items/[prefix_]"+item.picture+".png"
droppable False
hovered ShowTransient("inv_tooltip", item = item, pos = pos)
unhovered Hide("inv_tooltip")
if choice_func == "drag_chest":
dragged dragged_chest
elif choice_func:
dragged dragged_local
else:
dragged dragged_on_screen
drag_raise True
pos pos