How do I throw object with mouse?

Get help using Construct 2

Post » Fri Aug 28, 2015 12:22 pm

Hello.

Is there a behavior that let's us move an object with our mouse and, on release, it follows physics and gets thrown with a certain velocity?

Are there a lot of games that allow you to drag and throw objects?
B
6
Posts: 16
Reputation: 284


Post » Fri Aug 28, 2015 5:06 pm

Thank you. I'll try it when I get back.
B
6
Posts: 16
Reputation: 284

Post » Fri Aug 28, 2015 7:06 pm

@goodeddie

I tried Lordshiva's boomerang capx, and it launches when you click the mouse button, but it doesn't adjust the angle or velocity in relation to the mouse motion the way you wanted...

Here is a sample I made for someone a couple weeks ago (it started as a project to show the dots for a trajectory, and ended up being an angry birds clone). You can launch red birds with the slingshot - it sets the angle and velocity based on how you pull it. You can also pick up a white bird and just toss it. It works with both mouse and touch (and works well on my iPhone). Obviously, you have to calibrate the velocity when you throw things to match how you want the gameplay to work...

http://www.rieperts.com/games/forum/angry_birds.capx
B
99
S
35
G
20
Posts: 438
Reputation: 17,910

Post » Fri Aug 28, 2015 7:42 pm

Thank you Allan but I am not looking for the functionality in angry birds. I am looking for if I am holding an object with my mouse, after I move my mouse, I release the left click and the object continues in that direction. Just like if you throw a ball in real life, when you release it from your hand, the ball keeps going until it falls down.
B
6
Posts: 16
Reputation: 284

Post » Fri Aug 28, 2015 7:46 pm

@goodeddie

The .capx provided by @AllanR also contains that functionality.

You can also pick up a white bird and just toss it.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,561
Reputation: 60,466

Post » Fri Aug 28, 2015 7:50 pm

Oh thank you very much!!! I will look at it and try to implement it into my game.
B
6
Posts: 16
Reputation: 284

Post » Fri Aug 28, 2015 9:59 pm

Its a great demo! Thank you!!
B
6
Posts: 16
Reputation: 284

Post » Mon Aug 31, 2015 3:58 pm

Is there a way to stop an object at a certain place if you drag past it? I am having trouble when I drag a cube into my player. After I release it inside of the player, the player cannot move. I would like to stop the cube from going into the player. Do I have to build my own drag and drop logic?
B
6
Posts: 16
Reputation: 284


Return to How do I....?

Who is online

Users browsing this forum: Felipesz and 32 guests