I'm would like to achieve something like Object A will jump to position A in parabolic way. For example:
I am able to make the object jump but i do not know how to calculate to make the object jump to the precise location.
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
SKAction objects to accomplish most of its functionality. What you're seeking is
The following accomplishes this:
UIBezierPath *path = [UIBezierPath bezierPath]; [path moveToPoint:CGPointZero]; [path addQuadCurveToPoint:CGPointMake(deltaX/2, desiredHeight) controlPoint:CGPointMake(0, desiredHeight)]; [path addQuadCurveToPoint:CGPointMake(deltaX, deltaY) controlPoint:CGPointMake(deltaX, desiredHeight)]; CGPathRef pathref = path.CGPath; [jumpingNode runAction:[SKAction followPath:pathref duration:desiredDuration]];
This allows the Node to move along the specified path. It looks very uniform, but you can always add easing (related StackOverflow question) to give a more natural look