How do I know the direction in drag drop movment

Get help using Construct 2

Post » Fri Apr 03, 2015 6:18 pm

Hey is there any condition to know whether you're moving left or right using the drag drop ??
B
4
Posts: 4
Reputation: 208

Post » Fri Apr 03, 2015 7:17 pm

There isn't a condition, but there is an easy way to do it. All you need is a variable to store the position of the object when it was not being dragged and compare it against the X value of the object while it is being dragged.
B
38
S
12
G
11
Posts: 329
Reputation: 7,708

Post » Sat Apr 04, 2015 1:41 pm

I don't know If this is going to work, it's a catch game, you need to catch stuffs falling from above and you can move left or right using your finger, Now if you want to compare before drag and on drag I don't think it will affect something because you can go left and right while still on drag...
Do you mind if you can add me on skype to help me furher, my skype acc is : mamadoulecon
B
4
Posts: 4
Reputation: 208

Post » Sat Apr 04, 2015 4:18 pm

OK, I think I understand what you are looking for now. All you want is to force the object to move only on the X-Axis, right? Not, as you said
know whether you're moving left or right


All you need to do is, in the drag and drop properties, change the Axes to Horizontal instead of both. Select the object on the right and you will see it's properties on the left.
B
38
S
12
G
11
Posts: 329
Reputation: 7,708

Post » Sun Apr 19, 2015 8:54 pm

FragFather wrote:There isn't a condition, but there is an easy way to do it. All you need is a variable to store the position of the object when it was not being dragged and compare it against the X value of the object while it is being dragged.

Still having an Issue. I mean I have two frames for my object for while I am dragging it to the left and another for dragging it for the right. Let's say I start dragging it at position X=320. If I go right X will increase to let's say 420, thing is while still on drag (i did not drop yet) i can go left and X would decrease to 400. So basically I need to know if is object is being dragged left or right to set the frame...
B
4
Posts: 4
Reputation: 208

Post » Sun Apr 19, 2015 9:00 pm

add a variable oldx

first check
if x>oldx - drag is moving right
if x<oldx - drag is moving left

next event
set oldx = x
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
53
S
16
G
8
Posts: 6,157
Reputation: 19,744

Post » Sun Apr 19, 2015 9:09 pm

LittleStain wrote:add a variable oldx

first check
if x>oldx - drag is moving right
if x<oldx - drag is moving left

next event
set oldx = x

Awesome, it worked!!
Thank you !
B
4
Posts: 4
Reputation: 208


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 2 guests