我试图暂停场景,我可以用这段代码暂停它,但是当我点击同一个按钮时如何恢复呢?
@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;
}
}
}
答案 0 :(得分:1)
试试这个:
self.scene.view.paused = !self.scene.view.paused;