Sprite Node won't follow CGPath SWIFT

28 views
Skip to first unread message

Matthew Dryer

unread,
Feb 13, 2015, 4:41:30 AM2/13/15
to swift-l...@googlegroups.com
Can someone please tell me why my ball just disappears rather than follow the CG Path? I'm new to programming so I'm a little lost. Thank you!

 

    func shootBall () {

      

        let path = CGPathCreateMutable()

        

        CGPathMoveToPoint(path, nil, ball.position.x, ball.position.y)

        CGPathAddArcToPoint(path, nil, ball.position.x, ball.position.y, target.position.x, target.position.y, 200)

        

        let moveToTarget = SKAction.followPath(path, asOffset: true, orientToPath: true, duration: 5.0)

        let scaleBall = SKAction.scaleBy(0.3, duration: 0.5)

        let ballBundledMovements = SKAction.group([moveToTarget, scaleBall])

        

        

       ball.runAction(ballBundledMovements)

Jens Alfke

unread,
Feb 13, 2015, 11:27:56 AM2/13/15
to Matthew Dryer, swift-l...@googlegroups.com
This is more of a SpriteKit or CoreGraphics question. Try asking on Apple’s cocoa-dev list, or the developer forums.

—Jens
Reply all
Reply to author
Forward
0 new messages