當我從屏幕右側(self.frame.size.width)點擊屏幕右側到中心(自我)時,我正在測試我的遊戲。 frame.size.width/2)然後當你再次點擊它的雙方回到(self.frame.size.width)(關閉屏幕)Sprite Kit創建一個新的屏幕(重新啓動方法)
而不是改變我的重置方法中我所有的變數我想創建一個同一場景的新場景。
GameScene* NewScene = [GameScene sceneWithSize:self.view.bounds.size];
NewScene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:NewScene];
我的ViewController
scene.scaleMode = SKSceneScaleModeAspectFill;
它的工作原理,但(其假設是關閉屏幕),以及它的尺寸增大。
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self gameover];
if(direction == 1){
[self reset];
}
[self endInterFace];
for (UITouch *touch in touches) {
location = [touch locationInNode:self];
}
[self handleDirectionChange];
}
-(void)gameover{
[score_Display runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2+50) duration:0.30]];
[ScoreFINAL runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2+50) duration:0.30]];
[highScoreFINAL runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2-35) duration:0.30]];
[score_Retry runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2-120) duration:0.40]];
[score_Rate runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2-220) duration:0.55]];
[score_Share runAction:[SKAction moveTo:CGPointMake(self.frame.size.width/2, self.frame.size.height/2-300) duration:0.75]];
}
-(void)reset{
[score_Display runAction:[SKAction moveTo:score_DisplayXY duration:0.30]];
[ScoreFINAL runAction:[SKAction moveTo:CGPointMake(self.frame.size.width, self.frame.size.height/2+50) duration:0.30]];
[highScoreFINAL runAction:[SKAction moveTo:CGPointMake(self.frame.size.width, self.frame.size.height/2-35) duration:0.30]];
[score_Retry runAction:[SKAction moveTo:score_RetryXY duration:0.40]];
[score_Rate runAction:[SKAction moveTo:score_RateXY duration:0.55]];
[score_Share runAction:[SKAction moveTo:score_ShareXY duration:0.75]];
GameScene* NewScene = [GameScene sceneWithSize:self.view.bounds.size];
NewScene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:NewScene];
}
基本上重啓場景中的每個時刻u挖掘(只用於測試) – cheesey
只是一個隨機的猜測,但嘗試self.bounds.size –
羅我有, – cheesey