Page 1 of 1

Drag Item ?

PostPosted: Fri Jun 22, 2007 1:24 am
by fatouraee
I am trying to drag an item when I click on it and drag it till I release it.
Also I want to follow x only and between 2 points. I have tried every example and I have been working on it for 2 days and it doesn’t work.
I can drag the item any where or I know how to set it to follow x only but I can’t have it stop when I get to the wall or something. My main goal is to be able to drag this item between point XA and XB and when it get to these points it will stop and wont follow the mouse even when the mouse down is pressed.

How can I make it happen?
If you guys could help me with this I would appreciate it.
Thank you

PostPosted: Fri Jun 22, 2007 2:54 am
by Sgt. Sparky
make an actor variable called click.
when you press the mouse button down with drag disabled,
script editor->
Code: Select all
click = 1;

on mouse button up->script editor->
Code: Select all
click = 0;

on draw actor event of your actor->script editor->
Code: Select all
if(click == 1)
{
     x = view.x + xmouse;
}
if(x < 0)x = 0;
if(x > 100)x = 100;

the 0 and 100 are the 2 different points. :D