Page 1 of 1

Python class and Drag fonction

Posted: Fri Dec 15, 2017 10:05 am
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 :)

Re: Python class and Drag fonction

Posted: Fri Dec 15, 2017 1:28 pm
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 :)