我想暫停場景,我可以用這段代碼暫停它,但當我點擊相同的按鈕時,如何恢復它?如何恢復暫停按鈕 - 雪碧套件
@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; – LearnCocos2D