The set up of my game relies on placing several sprites along a curve that may look like a bow , ellipse, or be a bit more complex (assume it would be bezier curve then). I want to be able to place my sprites in somewhat equal distances apart.
Can anyone share how this could be done ?
Using cocos2d 2.1
I dont know if there is an easier method to do this ,but we could arrange the sprite along any curve by using the mathematical equation for that curve.
For a parabolic curve (advantage: symmetrical,so easy to place equidistant points) Find out a equation that satisfies your start and EndPoints and obtain the y values for equidistant x points between start and end using the function below.
example: y = -x^2 + 20x - 1 (general equation : y = ax^2 + bx + c)
You could come up with a similar function for Bezier curves : (Bezier cubic curve)
However, obtaining equidistant points on a bezier curve is a bit of a chore. On the other hand if you by equidistant you mean , distance only along the x axis then this should not be problem.