如何恢复暂停按钮-雪碧工具包



我正在尝试暂停场景,我可以用这个代码暂停它,但是当我点击相同的按钮时,我如何恢复它?

@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;
        }
    }
}

试试这个:

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

最新更新