Hi, i'm playing around with this wonderful piece of software and i LOVE it.
One question !!!
Is there an easier way to make a drag and drop than the way i have done:
Made a global numeric variable and set it to 0.
Set sprite position to mousex and mousey if global var is 1
If sprite clicked set global var to 1
if mouse up set global var to 0
Develop games in your browser. Powerful, performant & highly capable.
That's basically how I do that, but instead of using a global variable, I use an instance variable BOOLEAN typed.
on left click on sprite : selected to True
[NOT] left mouse down : selected to False
if selected : follow the mouse
Also I add an offset calculation to avoid the sprite to snap on the mouse position. For that I use 2 instance variable xOffset and yOffset
on left click on sprite :
Sprite selected = True
Sprite xOffset = self.X - Mouse.X
Sprite yOffset = self.Y - Mouse.Y
if [NOT] left mouse down : selected to False
if selected :
set X to Mouse.X+self.xOffset
set Y to Mouse.Y+self.yOffset
Oh and my way works with multiple instances, yours don't.
Cheers too o/
Oh and... The title of your topic has nothing to do with what you asked
Thank you for your reply.. I will try it your way.
And about the topic.. Darn..
I edited the post but forgot to edit the topic...