Page 1 of 1

Dragging the view (Please Reply fast :D)

PostPosted: Thu Jan 28, 2010 1:55 am
by Hblade
Dude this is getting annoying I cant turn the corner without running into a problem... GOD DUDE... Okay, this one is kidna hard. I'm trying to make a drag function BUT WITHOUT the drag_function because that has a constant drag, what I'M trying to do is make when you click (and hold) on something, and drag the mouse, it moves the view kidna like the main menu's dragging fucntion. However I only want to be able to do this when you have the "drag tool" on. (you select it by clicking on it in the options menu, long story) Anyways when the views X and Y were -320, and -240, it worked fine! but now all of a sudden, for SOME REASON, when I have (in create actor), x = -16, and y = -16 (for good reasons, 0 for some reason is bad for tiles and positioning, long story as well), but anyway this code doesn't work.
mouse button down:
Code: Select all
d_x = xmouse;
d_y = ymouse;
begin_drag = 1;

In draw_actor:
Code: Select all
xscreen = (xmouse - d_x);
yscreen = (ymouse - d_y);

I've also tried varias other methods PLEASE HELP SOMEONE

Re: Dragging the view (Please Reply fast :D)

PostPosted: Thu Jan 28, 2010 3:33 am
by skydereign
You mean like this? It isn't set up exactly like you explained, but I am pretty sure you know what to do from this point assuming this is what you wanted.

Re: Dragging the view (Please Reply fast :D)

PostPosted: Thu Jan 28, 2010 1:23 pm
by thunderios
I'd do something like
Code: Select all
view.x += mouse.x - mouse.xprevious
view.y += mouse.y - mouse.yprevious

in a function that is activated by a mouseclick.

Re: Dragging the view (Please Reply fast :D)

PostPosted: Thu Jan 28, 2010 2:19 pm
by Hblade
Sky's worked, but thanks anyways ^.^