swift CGPath移动了几个像素

时间:2017-05-29 09:25:05

标签: ios swift sprite-kit cgpath

我遇到了cgpath的问题。我的cgpath移动几个像素。如何在图片下设置cgpath我可以从png alpha获取cgpath吗?

    let Mountain = SKSpriteNode(imageNamed: "mountain1")
    // Ground =
    Mountain.setScale(0.5)
    Mountain.position = CGPoint(x: self.frame.width+(Mountain.frame.width/2)+CGFloat.random(min: 0, max: 100), y: startGround.frame.height-43 + Mountain.frame.height/2)
    let path = CGMutablePath()
    path.addLines(between: [CGPoint(x: 0.0, y: 0.0),CGPoint(x: 246.0, y: 510.0)])
    path.addLines(between: [CGPoint(x: 0.0, y: 700.0),CGPoint(x: 246.0, y: 510.0)])
    Mountain.physicsBody = SKPhysicsBody(edgeLoopFrom: path)

enter image description here

0 个答案:

没有答案