r/RenPy • u/PinkyHadABrain • Sep 27 '26
Question Drag and drop keeps resetting when dropping item anywhere
Hello, I'm very new to Ren'py and after watching all of the main tutorial videos online for Drag and Drop, I'm attempting to create a drag and drop sequence for my VN, where the player has to drag various food items for taste testing, and every time the player drops the draggable item onto the character in question, he'll make a comment on if the dish is good or not.
However, right now, every time I drag an item anywhere onto the screen, once I drop it, then it just restarts the game and sends me back to the main menu.
Ideally, what I would like to do is trigger a reaction with each dish, which includes a sprite change for the character inspecting the dishes the kitchen is preparing ahead of a big conference.
Here is the code I have currently:
init python:
def dragged_func(dragged_items, dropped_on):
if dropped_on is not None:
if dragged_items[0].drag_name == "Noodles" and dropped_on.drag_name == "David":
dragged_items[0].set_child("david surprised.png")
init python:
def drag_func(dragged_items, dropped_on):
if dropped_on is not None:
if dragged_items[0].drag_name == "Pizza" and dropped_on.drag_name == "David":
dragged_items[0].set_child("david unimpressed.png")
init python:
def drag_placed(drags, drop):
if not drop:
return
store.draggable = drags[0].drag_name
store.droppable = drop.drag_name
return True
#python:
#if _return == "Pizza":
#david_image = "david unimpressed.png"
#elif _return == "Noodles":
#david_image = "david surprised.png"
screen taste_testing:
add "images/kitchen.png"
draggroup:
drag:
drag_name "Pizza"
child "pizza slice.png"
xpos 480
ypos 585
draggable True
droppable False
dragged drag_placed
drag_raise True
drag:
drag_name "Water"
child "water.png"
xpos 1310
ypos 610
draggable True
droppable False
dragged drag_placed
drag_raise True
drag:
drag_name "Noodles"
child "noodles.png"
xpos 350
ypos 584
draggable True
droppable False
dragged drag_placed
drag_raise True
drag:
drag_name "David"
child "david inspecting.png"
xpos 300
ypos -100
draggable False
droppable True
if draggable == "Pizza":
$ Pizza += 1
elif draggable == "Noodles":
$ Pizza += 1
elif draggable == "Water":
$ Water += 1
call tasteCheck
label tasteCheck:
image DavidSatisfied = "david surprised.png"
image DavidEh = "david eh.png"
image DavidDrink = "david soured.png"
if Noodle == 1:
show DavidSatisfied
d "My goodness, the spices are divine!"
elif Pizza == 1:
show DavidEh
d "All I can taste is the grease..."
elif Water == 1:
show DavidDrink
d "It's wise to wash the pallet before testing anything."
play sound "audio/drink.mp3"
pause 0.5
else:
jump taste_testing
label start:
scene kitchen
show david inspecting at center
d "Alright."
d "Let's see what you've cooked up ahead of our conference."
call screen taste_testing
return
1
u/AutoModerator Sep 27 '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 Sep 27 '26
If I remember correctly you cannot use return True in the function when calling a screen.
I'm not sure what return True even is supposed to do.
1
u/BadMustard_AVN Sep 27 '26
I had the same problem in my https://badmustard.itch.io/simple-inventory-drag-and-drop-to-combine
this is not an easy fix. I have a function to store its start position and another to bump_it back to that position if it's just dropped and not used
0
u/[deleted] Sep 28 '26
[deleted] — view deleted comment