如何恢复暂停按钮 - 精灵套件

时间:2014-06-13 11:36:18

标签: ios objective-c sprite-kit

我试图暂停场景,我可以用这段代码暂停它,但是当我点击同一个按钮时如何恢复呢?

@property (SK_NONATOMIC_IOSONLY, getter = isPaused) BOOL paused;


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

 for (UITouch *touch in touches)
    {
        SKSpriteNode *pause = (SKSpriteNode*)[self childNodeWithName:@"pause"];

        CGPoint location = [touch locationInNode:self];

        if([pause containsPoint:location])
        {
            self.scene.view.paused = YES;
        }
    }
}

1 个答案:

答案 0 :(得分:1)

试试这个:

self.scene.view.paused = !self.scene.view.paused;