通过实现以下代码,我收到以下错误消息:
SKScene:动画SKScene的规模没有效果。
_popup = [SKSpriteNode spriteNodeWithImageNamed:@"popup.png"];
[_popup.texture setFilteringMode:SKTextureFilteringNearest];
_popup.position = CGPointMake(self.frame.size.width/2, self.frame.size.width);
[self addChild:_popup];
SKAction *appear = [SKAction scaleTo:1.6 duration:0.5];
SKAction *wait = [SKAction waitForDuration:10.0];
SKAction *disappear = [SKAction scaleTo:0.0 duration:0.5];
SKAction *removeFromParent = [SKAction removeFromParent];
SKAction *sequence = [SKAction sequence:@[appear, wait, disappear, removeFromParent, [SKAction runBlock:^{
[self newScene];
}]]];
[self runAction:sequence];
你有想法吗?
修改
这是工作代码:
_popup = [SKSpriteNode spriteNodeWithImageNamed:@"popup.png"];
_popup.position = CGPointMake(self.frame.size.width/2, self.frame.size.width);
[self addChild:_popup];
SKAction *appear = [SKAction scaleTo:1.6 duration:0.5];
SKAction *wait = [SKAction waitForDuration:5.0];
SKAction *disappear = [SKAction scaleTo:0.0 duration:0.5];
SKAction *remove = [SKAction removeFromParent];
SKAction *rblock = [SKAction runBlock:^{ [self newScene]; }];
SKAction *sequence = [SKAction sequence:@[appear, wait, disappear, rblock, remove]];
[_popup runAction:sequence];
重要的是要放置" rblock"之前"删除"并改变" [self runAction:sequence];"用" [_ popup runAction:sequence];"。这就是全部!