0

我的游戏使用物理,我确实成功暂停了它,但我无法恢复它。节点实际上是下落的物体,暂停时它们会停留在空中,并且在暂停场景时所有物理都按预期消失。但是当我恢复时,它们会停留在空中,不会掉落,我也看不到任何类型的物理正在恢复。任何建议将不胜感激。这是我使用的:

-(void) pause{
self.scene.paused = YES;
backgroundView = [[UIView alloc] initWithFrame:self.view.bounds];
[backgroundView setBackgroundColor:[UIColor blackColor]];
[backgroundView setAlpha:.5];

UIImageView *imV = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"resume.png"]];
[imV setFrame:backgroundView.frame];
[imV setContentMode:UIViewContentModeScaleAspectFit];
[backgroundView addSubview:imV];
[backgroundView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPause:)]];
[self.view addSubview:backgroundView];


}

-(void) tapPause:(id)sender{

[UIView animateWithDuration:.3 animations:^{
    backgroundView.alpha = 0;
} completion:^(BOOL finished) {
    backgroundView = nil;
    [backgroundView removeFromSuperview];
}];

self.scene.view.paused = NO;
}
4

1 回答 1

2

我压缩了代码。也许你能发现错误。;)

self.scene.paused = YES;

self.scene.view.paused = NO;
于 2014-06-25T18:04:12.627 回答