0
如何设置SKTexture的尺寸Ive通过文档Class Reference我没有看到能够设置尺寸的任何内容。我知道尺寸方法是一种返回方法,但只是为了清楚我在下面的代码中想要做什么。SKTexture的设置尺寸
_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的大小。但是,如果我这样做,我如何从炸弹所在的中心位置改变图像的大小?
是否有替代SKAction,因为我似乎无法找到一个功能来帮助我。你可以告诉我一些代码,当倒数结束时你将如何执行SpriteNode交换。谢谢 – 4GetFullOf
不,没有任何内置的replaceAction,但有'performSelector:onTarget:'和'customActionWithDuration:actionBlock:'这可以用于基本上任何事情...... –