Приветствую, это мое первое сообщение на просторах вашего форума ) надеюсь на помощь.
Я решил анимировать текстурку в spriteKit через Atlas, симулятор запускается без проблем, но текстурка не отображается (отображается в виде красного крестика) (ошибка Atlas ‘bee’ cannot be found.)
Код GameScene.swift
import SpriteKit
import GameplayKit
class GameScene: SKScene {
override func didMove(to view: SKView) {
self.backgroundColor = UIColor(red: 0.4, green: 0.6, blue:
0.95, alpha: 1.0)
// создаем: bee sprite
// Note: Remove all prior arguments from this line:
let bee = SKSpriteNode()
bee.position = CGPoint(x: 250, y: 250)
bee.size = CGSize(width: 28, height: 24)
self.addChild(bee)
// Find our new bee texture atlas
let beeAtlas = SKTextureAtlas(named: "bee.atlas")
// Grab the two bee frames from the texture atlas in an array
// Note: Check out the syntax explicitly declaring beeFrames
// as an array of SKTextures. This is not strictly necessary,
// but it makes the intent of the code more readable, so I
// chose to include the explicit type declaration here:
let beeFrames: [SKTexture] = [
beeAtlas.textureNamed("bee.png"),
beeAtlas.textureNamed("bee_fly.png")]
// Create a new SKAction to animate between the frames once
let flyAction = SKAction.animate(with: beeFrames, timePerFrame: 0.14)
// Create an SKAction to run the flyAction repeatedly
let beeAction = SKAction.repeatForever(flyAction)
// Instruct our bee to run the final repeat action:
bee.run(beeAction)
}
текстурки находятся: Enemies/bee.atlas/
Texture Atlas ‘bee’ cannot be found.