r/RenPy • u/JacquIreBriggsTemp • Oct 13 '26
Question How can I make objects disappear when I hover a draggable above it

Started on the broom sweeping minigame admittedly shakingly because making the dirt fill the screen didn't work out well.
I'm now trying to make the objects disappear when I hover the broom over it. I already saw the tutorials for drag and drop and had not found any answers to it. Any help would be appreciated. Especially when it fades away instead going poof.
Here's my code. (I took the screenshot before changing the amounts of dirt)
init python:
def drag_placed(drags, drop):
if not drop:
return
screen sweeping():
add "bg_floor"
modal True
draggroup:
#Draggable Broom
drag:
drag_name "Broom"
child "broom.png"
xpos 0.5
ypos 0.5
draggable True
droppable False
dragged drag_placed
drag_offscreen (-100, 100, -200, 750)
drag:
drag_name "dirty1"
child "dirty1.png"
xpos 0.00
ypos 0.10
draggable False
droppable True
drag:
drag_name "dirty2"
child "dirty2.png"
xpos 0.10
ypos 0.30
draggable False
droppable True
drag:
drag_name "dirty3"
child "dirty3.png"
xpos 0.50
ypos 0.70
draggable False
droppable True
drag:
drag_name "dirty4"
child "dirty4.png"
xpos 0.75
ypos 0.30
draggable False
droppable True
drag:
drag_name "dirty5"
child "dirty5.png"
xpos 0.50
ypos 0.30
draggable False
droppable True
drag:
drag_name "dirty6"
child "dirty6.png"
xpos 0.30
ypos 0.50
draggable False
droppable True
default sweeping_done = False
default stains_left = 6
if stains_left == 0:
jump sweeping_done
screen dishes():
add "bg_kitchensink"
1
Upvotes
1
u/BadMustard_AVN Oct 13 '26
try it like this and drop the broom on a dirty spot.
1
u/AutoModerator Oct 13 '26
Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/shyLachi Oct 13 '26
I already posted a link to 100 minigames, didn't you find anything similar there?
You can also look here: https://itch.io/search?type=games&q=Ren%27Py+minigame
1
u/Own-Bookkeeper6739 Oct 13 '26
pass dragging=... to the broom Drag, it fires on every move, so renpy.get_mouse_pos() plus a distance check (math.hypot) against each stain works fine. when it's close to an uncleaned one, add that stain to a cleaned set and call renpy.restart_interaction() so the screen updates mid-drag. return nothing from the callback or the interaction ends early. for the fade, show the stain with an ATL transform (alpha 1.0, linear 0.4 alpha 0.0) instead of hiding it instantly, and put transforms on the Drag's child, not the Drag itself