I'm making a game where the user can shoot a ball.
The balls velocity increases the further away the mouse is from the cannon when they click.
Although, I want the balls velocity to increase up to a certain point.
So when they click I want to do something like this:
If the distance from cannon is > 500, then force = 500 else force = distance
But the only way I can see doing this is by making a variable and then assigning that the distance and then using that variable to check that the distance isn't over 500 and then assign a force based on that result.
What is the appropriate approach for this?
Right now my event is
Apply force distance(ball.X, ball.Y, Touch.X, Touch.Y) * 5 toward (Touch.X, Touch.Y)