Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/98.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 设置纹理的大小_Ios_Animation_Ios7_Sprite Kit_Sktexture - Fatal编程技术网

Ios 设置纹理的大小

Ios 设置纹理的大小,ios,animation,ios7,sprite-kit,sktexture,Ios,Animation,Ios7,Sprite Kit,Sktexture,我如何设置SKTexture的大小?我查阅了文档,没有看到任何关于设置大小的信息。我知道size方法是一个返回方法,但只是为了明确我在下面的代码中要做什么 _bomb = [SKSpriteNode spriteNodeWithImageNamed:@"Bomb5.gif"]; SKTexture *Bomb5 = [SKTexture textureWithImageNamed:@"Bomb5.gif"]; Bomb5.size = CGSizeMake(40, 40

我如何设置SKTexture的大小?我查阅了文档,没有看到任何关于设置大小的信息。我知道size方法是一个返回方法,但只是为了明确我在下面的代码中要做什么

    _bomb = [SKSpriteNode spriteNodeWithImageNamed:@"Bomb5.gif"];

    SKTexture *Bomb5 = [SKTexture textureWithImageNamed:@"Bomb5.gif"];
    Bomb5.size = CGSizeMake(40, 40);

    SKTexture *Bomb4 = [SKTexture textureWithImageNamed:@"Bomb4.gif"];
    Bomb4.size = CGSizeMake(40, 40);

    SKTexture *Bomb3 = [SKTexture textureWithImageNamed:@"Bomb3.gif"];
    Bomb3.size = CGSizeMake(40, 40);

    SKTexture *Bomb2 = [SKTexture textureWithImageNamed:@"Bomb2.gif"];
    Bomb2.size = CGSizeMake(40, 40);

    SKTexture *Bomb1 = [SKTexture textureWithImageNamed:@"Bomb1.gif"];
    Bomb1.size = CGSizeMake(40, 40);

    SKTexture *explostion = [SKTexture textureWithImageNamed:@"explosionnn.gif"];
    explostion.size = CGSizeMake(90, 90);
    //5 second countdown and the bomb explodes
    countdown = [SKAction animateWithTextures:@[Bomb5,Bomb4, Bomb3, Bomb2, Bomb1, explostion] timePerFrame:1];

另一个解决方案:也许我可以按顺序添加动作,在5秒倒计时后,当spriteNode到达最后一个动画图像时,我可以更改spriteNode的大小。但是如果我这样做,我如何从炸弹所在的中心原点更改图像的大小?

你是对的:你不能更改纹理的大小,因为纹理本质上就是图像:“SKTexture对象是一个可以应用于SKSpriteNode对象或由SKmitterNode对象创建的粒子的图像。”(摘自)


你是否考虑过为爆炸使用一个单独的精灵?然后,当倒计时达到零时,你可以简单地用它替换倒计时精灵。如果你使用工厂类来创建你的精灵,如果你想在游戏中的其他地方使用相同的爆炸,这也会为你节省很多麻烦…

是否有替换SKB动作因为我似乎找不到一个函数来帮助我。你能用一些代码告诉我当倒计时结束时你将如何执行SpriteNode交换吗。谢谢没有任何内置的替换操作,但是有
performSelector:onTarget:
customActionWithDuration:actionBlock:
可以用于basical随便什么。。。