我试图在我的快速游戏中用两种颜色填充我的球>我希望它们是半白半蓝。我尝试将球改成SKSpriteNode,但它破坏了整个项目和所有物理。无论如何要制作球型两种颜色或在球上放置图像?谢谢
答案 0 :(得分:0)
尝试使用SKSpriteNode
:
SKShapeNode
let textureBall : SKTexture! = SKTexture(imageNamed:"ball.png")
let ballSize: CGSize = textureBall.size
ball = SKShapeNode.init(circleOfRadius: ballSize.width/2)
ball.fillTexture = textureBall
ball.strokeColor = UIColor.clearColor()
ball.position = CGPointMake(CGRectGetMidX(self.frame),CGRectGetMidY(self.frame))
ball.name = "ball"
ball.zPosition = 1
ball.fillColor = UIColor.redColor() // use the color you want
self.addChild(ball)