How would I make it so the player shoots the basketball?

I am trying to make a basketball game and I am having trouble with making the player shoot the basketball, I don’t know how to calculate the shot arc and stuff like that, and I also want to be able to be some randomness in the shot based on certain variables, but before that I want to complete the basics first… Any ideas on how I could do this?

You can use the physics 2 behaviour for that. Choose the angle when the force is applied to the ball, and that’s it.

Starter video : Physics Engine 2.0 - In Depth Tutorial - GDevelop - YouTube

I tried what you suggested, but the ball doesn’t go where i want it to, here is a gif of what happens:
These are the events I put, what did I do wrong?

Hoop.Angle() is the angle of the Hoop object, and most likely 0. And you don’t want the angle to the hoop, because gravity will pull it down. You’ll have to work out the best angle.

And depending on your Physics behaviour settings (I’m assuming the ball has a mass of 1 and gravity of 1), using a force of around 400 may be sufficient. Also, apply the force to the centre of the ball :


I tried doing what you said, but now the ball just rockets into the sky endlessly, and the ball doesn’t really go towards the hoop, if i shoot from somewhere other than the front of the hoop, it doesn’t go towards the hoop. How could I make sure the ball has enough force to go clean into the hoop and update the force so if I’m shooting from further out it may apply more force or if I am shooting from the wing the force will update?

While trying to figure out an answer for my curiosity as well, I found an interesting tutorial by an interesting person. I want to try it. It’s not basketball but the physics are very close.