How do I know the direction in drag drop movment

  • Hey is there any condition to know whether you're moving left or right using the drag drop ??

  • 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.

  • 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

  • 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 [quote:giy1ciz8]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.

  • 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...

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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 !

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)