Sprite Node won't follow CGPath SWIFT

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Sprite Node won't follow CGPath SWIFT

Matthew Dryer
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)

--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/a3380d67-d2ab-49a8-b5c9-5ad9db75838f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Sprite Node won't follow CGPath SWIFT

Jens Alfke
This is more of a SpriteKit or CoreGraphics question. Try asking on Apple’s cocoa-dev list, or the developer forums.

—Jens

--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/FB1ABA46-9C0B-4BBF-932C-8C7BB0A19E1C%40mooseyard.com.
For more options, visit https://groups.google.com/d/optout.