How to use a sprite sheet in a quick and sprite set?

The name says it all. How to use a sprite sheet in a set of fast and sprites? I was looking for google, stack exchange and apple documentation, and I can't figure out how to do this.

+4
source share
1 answer

In xcode 7, you can use Images.xcassets to create a sprite atlas.

  • Click on Images.xcassets
  • Click on the bottom bottom in the bottom left
  • Select "New Sprite Atlas"
  • Then you can drag all the images to the atlas

If you drag all three image sizes with the appropriate suffix (@ 2x and @ 3x), it will automatically fill in your images.

:

let atlas = SKTextureAtlas(named: "Sprites")
let texture = atlas.textureNamed("ball")
let sprite = SKSpriteNode(texture: texture)

:

let texture = SKTexture(imageNamed: "ball")
let sprite = SKSpriteNode(texture: texture)

, SO: xcode.

+4

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


All Articles