Swift SpriteKit: png image appears black during the game. How to fix it?

I am making a game using Xcode, Swift and SpriteKit. I made a PNG image in Photoshop that implies transparency, and in the game it looks black. I have other png images that also include transparency and they look the way they are supposed to. I do not think that this is a problem with the code, but just in case, here is the code that introduces the image into the game (it is inside the function didMoveToView):

    let warning = SKSpriteNode(imageNamed: "yellow_warning")
    warning.setScale(0.1)
    warning.anchorPoint = CGPoint(x: 0, y: 0.5)
    warning.position = CGPoint(x: CGRectGetMinX(self.scene!.frame)+296, y: CGRectGetMidY(self.scene!.frame))
    warningsNode.addChild(warning)

warningsNodeis simple SKNodeand is a child of the scene.

Here is the image I'm using

Here is a picture

Thank you for your help!

+4
source share
1

. , , 270x9000 . iPhone/iPad/Mac . , iPhone/iPad, ( ) 4096x4096. max, OpenGL , .

, 4096 ( ). , . , , .

EDIT: 270x10 , , , ( , ).

+5

Source: https://habr.com/ru/post/1615876/


All Articles