Drag and Throw?

0 favourites
  • 9 posts
From the Asset Store
Throw daggers and hit the most fruit! Watch out for the wind, if you run out of daggers you'll lose the game!
  • Without blasted drag and drop, can someone explain to me the best way to pick up an object with the mouse pointer, move it over some distance, and drop/throw it by letting go of the click?

    If possible, I would like it to move towards the position of the mouse, and then letting to of the object doesn't throw it, but rather, releases hold of it. I tried this with phys force but it's way too wobbly.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's one I made earlier: Example capx.

  • Hi!

    I tried your example GeometriX and it works great! I have only one issue: When the screen starts scrolling (because of the scroll-to behavior) then the ball instantly drops. What could be the reason for that?

  • GeometriX why when i try drag ball nothing hapen?

  • neutrinox, yeah, mixing in the scroll-to behaviour is sure to cause a lot of trouble. I'd suggest rather creating an invisible follow object with the custom movement behaviour that chases the ball, and scroll to that, rather. Or only activate the scroll-to on release of the ball.

    delgado, you'll have to provide a little more information. I just tested my example again and it works fine. Not sure what issue you're having exactly.

  • GeometriX i just clicking on the ball try dragging and ball dont move dont drag

  • delgado, sorry, I have no idea why it's not working for you. It's a very simple example and at the very least the actual click-and-drag action should work, even if the throwing doesn't for whatever reason.

  • Here is another slightly different method that uses physics (although that should be easy to change) and measures the time from the touch to the release to alter the speed of the throw.

    capx

  • Haven't tested this but you can try.

    Create an object that follows your mouse the whole time. When you click the object you want to throw create a joint between it and the object that follows your mouse, then on button release destroy the joint.

    Should work.

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