我正在制作游戏并试图为我的游戏设置背景。这是代码:
playerLight.enabled = true
playerLight.categoryBitMask = 1
playerLight.falloff = 1
playerLight.ambientColor = SKColor(red: 255, green: 255, blue: 255, alpha: 0.5)
playerLight.lightColor = SKColor(red: 0, green: 0, blue: 0, alpha: 0.01)
playerLight.shadowColor = SKColor(red: 0, green: 0, blue: 0, alpha: 0.05)
playerLight.position = CGPoint(x: alien.position.x, y: alien.position.y)
self.addChild(playerLight)
background = SKSpriteNode(imageNamed: "underwater_background")
background.xScale = self.frame.width
background.yScale = self.frame.height
background.position = CGPoint(x: 0, y: 0)
background.zPosition = 10
背景出来了,但全黑,覆盖了屏幕上的所有内容。我认为黑色是因为着色器,但我不确定。当我将zPosition设置为1或0时,它会覆盖除按钮和播放器之外的所有内容。任何帮助? (如果你需要剩下的代码请问,我不想覆盖屏幕)
谢谢, 詹姆斯