gpt4 book ai didi

ios - 将SKTexture加载到设备时出错

转载 作者:行者123 更新时间:2023-12-01 17:53:06 25 4
gpt4 key购买 nike

我已经创建了在模拟器上可以正常工作的动画,但是当我使用设备时,屏幕上会出现一个大十字。我收到以下日志消息。

SKTexture: Error loading image resource: "Bird1"

我已经仔细检查了所有纹理都在捆绑资源中。它怎么会不显示在设备上?
    SKTexture* birdTexture1 = [SKTexture textureWithImageNamed:@"Bird1"];
birdTexture1.filteringMode = SKTextureFilteringNearest;

SKTexture* birdTexture2 = [SKTexture textureWithImageNamed:@"Bird2"];
birdTexture2.filteringMode = SKTextureFilteringNearest;
SKTexture* birdTexture3 = [SKTexture textureWithImageNamed:@"Bird3"];
birdTexture3.filteringMode = SKTextureFilteringNearest;
SKTexture* birdTexture4 = [SKTexture textureWithImageNamed:@"Bird4"];
birdTexture4.filteringMode = SKTextureFilteringNearest;
SKTexture* birdTexture5 = [SKTexture textureWithImageNamed:@"Bird5"];
birdTexture5.filteringMode = SKTextureFilteringNearest;
SKTexture* birdTexture6 = [SKTexture textureWithImageNamed:@"Bird6"];
birdTexture6.filteringMode = SKTextureFilteringNearest;
SKAction *flap = [SKAction repeatActionForever:[SKAction animateWithTextures:@[birdTexture1, birdTexture2, birdTexture3, birdTexture4, birdTexture5, birdTexture6] timePerFrame:0.15]];

SKSpriteNode *mover = [SKSpriteNode spriteNodeWithTexture:birdTexture1];
[mover setScale:1.0];
mover.position = CGPointMake(self.frame.size.width / 2, self.size.height-120);

[mover runAction:flap withKey:@"birdGo"];

[self addChild:mover];

最佳答案

您是否尝试过如下扩展名的图像文件名?

SKTexture* birdTexture1 = [SKTexture textureWithImageNamed:@"Bird1.png"];

否则请尝试其他方法,如下所示
SKTexture * texture = [SKTexture textureWithImage:[UIImage imageNamed:@"rocket.png"]];

关于ios - 将SKTexture加载到设备时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23470788/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com