Drag Item ?

Non-platform specific questions.

Drag Item ?

Postby fatouraee » Fri Jun 22, 2007 1:24 am

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
fatouraee
 
Posts: 4
Joined: Wed Jun 20, 2007 6:39 pm
Score: 0 Give a positive score

Postby Sgt. Sparky » Fri Jun 22, 2007 2:54 am

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
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest