Drag and drop Horizontal and vertical

Get help using Construct 2

Post » Wed Jul 04, 2012 10:33 pm

is there a way to move the object that have drag and drop behavior in Horizontal (x axis) or vertical (y axis) also can i compare if it moving down or up?? because i want to create a variable that check if this object moving up or down so i can do the actions i want ^^

B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Wed Jul 04, 2012 11:02 pm

It's not perfect, but maybe this will do? I compare movement in X direction to movement in Y direction, then lock movement to the axis that has seen the most change. Click top/bottom to move vertically, left/right to move horizontally.

DragAxisRestrict.capx (r97)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jul 04, 2012 11:36 pm

@Nimtrix , this is what i want but the problem i want something like if i moved just right it will change variable to 1 if left to 2 and if nathing then 0 and same to up and down i tried to compare old.y with mouse.y but didn't work
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Thu Jul 05, 2012 12:02 am

I only set oldX and oldY once, so in order to constantly check which direction it's moving in, you'll need to update the variables.

So something like this:
DragAxisRestrict_Direction.capx (r97)Nimtrix2012-07-05 00:02:23
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Jul 05, 2012 2:41 am

@Nimtrix , thanks its work fine ^^
B
48
S
15
G
6
Posts: 795
Reputation: 12,035


Return to How do I....?

Who is online

Users browsing this forum: Zebbi and 27 guests