Python class and Drag fonction

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
sculpteur
Veteran
Posts: 312
Joined: Fri Nov 17, 2017 6:40 pm
Completed: Apocalypse Lovers
Projects: Apocalypse Lovers
Organization: Awake_Production
Location: France
Discord: https://discord.gg/apocalypse-lovers
Contact:

Python class and Drag fonction

#1 Post by sculpteur »

Hi,

I don't know if its doable because its seems really complicated to me and I have no idea where I should start.

But I want to drag an image button (or a simple image if its necessary) from my inventory screen (which is linked to a Python inventory system).

I want to be able to drag it everywhere on the screen and put it in a container (a square) which is somewhere on the screen (with coordinates).
But, if its not inside this square when the player release it, the image button should come back directly to his original spot.
If its in the square, the image button (inventory icon) will stick inside the square and disappearform the inventory menu.
I only know how to do the second part (make it disappear from the inventory screen thanks to the item.drop fonction).
But I don't know how to make the first part (with the square coordinate condition).

If you have any idea let me know it will be great :)
Image

“He asked me to calm down, close my eyes and be quiet. He explained to me that if I was afraid, the shadow that ran barefoot in the street would feel it. I got scared seeing Jumanji on TV, so let me tell you, we didn't stay hidden for long and had to start running again.”
Jessica's Diary.

sculpteur
Veteran
Posts: 312
Joined: Fri Nov 17, 2017 6:40 pm
Completed: Apocalypse Lovers
Projects: Apocalypse Lovers
Organization: Awake_Production
Location: France
Discord: https://discord.gg/apocalypse-lovers
Contact:

Re: Python class and Drag fonction

#2 Post by sculpteur »

Nevermind I find and other way to do what i was trying to do.

I've use an other sub class on the model of my inventory class and I called it container.
And I just had to play with item_use and append / remove fonction to do it.

I give up to use the drag fonction in all that mess, it was to luxuous for me anyway :)
Image

“He asked me to calm down, close my eyes and be quiet. He explained to me that if I was afraid, the shadow that ran barefoot in the street would feel it. I got scared seeing Jumanji on TV, so let me tell you, we didn't stay hidden for long and had to start running again.”
Jessica's Diary.

Post Reply

Who is online

Users browsing this forum: Google [Bot]