Drag and Throw?

Get help using Construct 2

Post » Sun Mar 24, 2013 4:46 am

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.
B
10
S
3
G
3
Posts: 234
Reputation: 3,467

Post » Sun Mar 24, 2013 10:06 am

Here's one I made earlier: Example capx.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Sun Feb 16, 2014 2:55 pm

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?
B
9
S
1
Posts: 95
Reputation: 711

Post » Sun Feb 16, 2014 4:17 pm

@GeometriX why when i try drag ball nothing hapen?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Sun Feb 16, 2014 5:16 pm

@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.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Mon Feb 17, 2014 1:54 am

@GeometriX i just clicking on the ball try dragging and ball dont move dont drag
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » Mon Feb 17, 2014 8:08 am

@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.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942

Post » Mon Feb 17, 2014 8:55 am

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
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
59
S
30
G
34
Posts: 1,194
Reputation: 23,767

Post » Mon Feb 17, 2014 2:13 pm

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.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
7
S
3
G
1
Posts: 263
Reputation: 1,425


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests