How do I Fling an object..?

Get help using Construct 2

Post » Sat Apr 29, 2017 2:47 pm

Ok, so i want to have a mechanic like you click on hold (let's say) a block, and when you move the mouse to the right of it and let go, it will fling the block towards that point. How would i set this up?

So far, all that happens in the block is moved and carried by my curser. I hope this all makes sense!

Thanks!
B
4
Posts: 19
Reputation: 240

Post » Sat Apr 29, 2017 3:11 pm

Slingshot -

Using 8 direction or platform.

On clicked object, set object as selected by saving it's UID to a variable.

On clicked released, pick object by saved his - set object vector and max speed x,y to difference in mouse position and object x,y.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442

Post » Sat Apr 29, 2017 3:15 pm

I'm sorry, i'm really new to and i have no idea what the second part of your answer means D:
B
4
Posts: 19
Reputation: 240

Post » Sat Apr 29, 2017 3:19 pm

i've managed to get it whenever i click it moves to the right.. but not towards the cursor, no matter where i put the cursor.
B
4
Posts: 19
Reputation: 240

Post » Sat Apr 29, 2017 3:21 pm

Not at a computer right now, I can make you an example later. Although I'm sure you should be able to find some already existing examples if you search.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442

Post » Sat Apr 29, 2017 3:24 pm

That would be great. It's similar to angry birds mechanics, except i want the block to go towards my cursor depending how far i drag the block, if that makes sense.
B
4
Posts: 19
Reputation: 240

Post » Sun Apr 30, 2017 7:42 pm

https://www.dropbox.com/s/iri6y30n0q47a ... .capx?dl=0

I used bullet instead of 8direction, since 8 direction decelerates x and y vectors independently and there was no way to set angle of motion, resulting in an undersirable movement path.

You can probably leave out the picking by UID if you only ever have one block at a time.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,697
Reputation: 64,442

Post » Mon May 01, 2017 12:23 am

On C2, go to File -> New and search for Physics Catapult. It's an angry birds-style game that does exactly what you need.
B
125
S
43
G
41
Posts: 849
Reputation: 28,260


Return to How do I....?

Who is online

Users browsing this forum: Kyatric, Yahoo [Bot] and 49 guests