Dragging the view (Please Reply fast :D)

Non-platform specific questions.

Dragging the view (Please Reply fast :D)

Postby Hblade » Thu Jan 28, 2010 1:55 am

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
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

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

Postby skydereign » Thu Jan 28, 2010 3:33 am

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.
Attachments
screenmove.zip
(1.29 KiB) Downloaded 43 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

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

Postby thunderios » Thu Jan 28, 2010 1:23 pm

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.
thunderios
 
Posts: 87
Joined: Thu Jan 31, 2008 1:18 pm
Score: 1 Give a positive score

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

Postby Hblade » Thu Jan 28, 2010 2:19 pm

Sky's worked, but thanks anyways ^.^
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron