Drag and Drop Child (how to set different images for hover, etc?)

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.
Post Reply
Message
Author
User avatar
MoonByte
Regular
Posts: 173
Joined: Thu Mar 24, 2016 9:18 pm
Completed: Shine (RPG Maker), Heroes (RPG Maker), Lantern Bearer (RPG Maker), Loop the Loop (Unity), Other Stars (Unreal), Sky Eye (RPG Maker), WIN Delivery & Fateful (Ren'Py)
Projects: Weird Is Normal (Ren'Py)
Location: Germany
Contact:

Drag and Drop Child (how to set different images for hover, etc?)

#1 Post by MoonByte »

I was following this tutorial on how to make a simple Drag and Drop. Which works.
He linked to the Documentation for it which explains a bunch of things real nicely as well.
But I am afraid, my non-programmer card is showing cause I have no clue how to change the image of my dragable based on it's state.
The wiki says this:
A Drag has one child. The child's state reflects the status of the drag and drop operation:
  • selected_hover - when it is being dragged.
  • selected_idle - when it can be dropped on.
  • hover - when the draggable will be dragged when the mouse is clicked.
  • idle - otherwise.
What I understand from that is that there's four default images I can set:
  • the object when it's untouched (idle)
  • the object when the mouse is hovering over it aka it shows it can be picked up (hover)
  • the object while actively being held (selected_hover)
  • the object when it is being held over a droppable (selected_idle)
All cool and nice, but the embarrassing part is that I have no idea how to simply define each of them and the Wiki's examples all don't use any of them.
Based on the video tutorial I have this code:

Code: Select all

drag:
            drag_name "shirt"
            child "Shirt.jpg"
            xpos 100
            ypos 100
            draggable True
            droppable False
            dragged drag_placed
            drag_raise True
I have now tried a variety of things, among them

Code: Select all

child auto "Shirt_%s.jpg"
and

Code: Select all

child
	hover "Shirt_hover.jpg"
	idle "Shirt_idle.jpg"
They all spit out errors for either indentation or "expected a keyword or end of line".
I used the search function on the Wiki for "child" which brought me to the ATL page which kept mentioning child, so I thought that maybe I can simply put

Code: Select all

image auto "Shirt_%s.jpg"
and call it a day, but it complains that it needs a statement.

Code: Select all

child auto "Shirt_%s.jpg"
straight up says it can't find image "Shirt_%s.jpg", clearly ignoring the 'auto' function.

Can anyone give me the short and easy on how to tell Renpy which image file to look at for what state?

Post Reply

Who is online

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