Page 1 of 1

Drag multiple objects

PostPosted: Thu Jan 15, 2009 12:17 pm
by Leif
Good day.

Here's a problem, which i have not solve yet, but I'm still trying :)
The task is: drag and drop actor. all the clones must move simultaneously and all the distances between clones could not be changed. We can drag anyone of clones - other move with him. We can add or remove clones.

I've tried two ways:
1. Change parent. On mouse_down event-Drag enable. Chosen clone must become parent for others, so other will move too. Does not work :)
2. I saw it somewhere here at the forum.
Actor named "zzz"
Global variable click, actor variables dX,dY

On clone's mouse down event
dX=xmouse-x+view.x;
dY=ymouse-y+view.y;

click=1;


on mouse up -
click=0;


On draw actor event
if(click == 1)
{ x = view.x + xmouse - dX;
y = view.y + ymouse - dY;
}


dX and dY are to store distance between each clone coordinates and mouse.

So, it does not work too. What is wrong?

Or, maybe somebody knows another solution?

Re: Drag multiple objects

PostPosted: Fri Jan 16, 2009 12:36 am
by skydereign
Upon mouse button down of actor test, set drag
Code: Select all
ChangeParent("test", "Event Actor");


Upon mouse button up of actor test
Code: Select all
ChangeParent("test", "(none)");