Ragdoll Blaster
I want to create ragdoll blaster type cannon. Suppose user tap near to cannon then cannon fire with low power and if user click distance is far from cannon that time cannon fire with more power.
Is there any example demo available for that? Please let me know how to do that? Thanks
Is there any example demo available for that? Please let me know how to do that? Thanks
Comments
For example distance between cannon and player tap is 50 pixel that time cannon blast slowly and when distance is 400 that time cannon fire with more power.
Get the position of the tap and the position of the cannon.
Do a magnitude function for distance.
Use that as the velocity that the cannonball shoots. If the scale is not right, then adjust it. For example, if it is 100, but half that is more appropriate, do .5*(magnitude of the thing). If you desire some sort of curve (in many games like that, it's not linear, and the farther taps are much stronger than the close ones), then you could use a curve function.
Good luck!