Drag multiple objects

Game Editor comments and discussion.

Drag multiple objects

Postby Leif » Thu Jan 15, 2009 12:17 pm

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?
User avatar
Leif
 
Posts: 147
Joined: Mon Dec 15, 2008 12:42 pm
Location: Moscow, Russia
Score: 10 Give a positive score

Re: Drag multiple objects

Postby skydereign » Fri Jan 16, 2009 12:36 am

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)");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron