Reputation: 516
I am testing my game over method when u tap the display sides across from the the right side of the screen (self.frame.size.width) to the center(self.frame.size.width/2) then when u tap again it sides back to (self.frame.size.width)(off the screen)
instead of changing all my varibles in my reset method i want to create a new scene of the same scene.
GameScene* NewScene = [GameScene sceneWithSize:self.view.bounds.size];
NewScene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:NewScene];
my viewcontroller
scene.scaleMode = SKSceneScaleModeAspectFill;
It works but (its suppose to be off the screen) and also its size increased.
-(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];
}
Upvotes: 0
Views: 44
Reputation: 391
As stated in the comments, the issue was that the view might be distorted because of the aspect ratio
solution:
Replace
GameScene* NewScene = [GameScene sceneWithSize:self.view.bounds.size];
With
GameScene* NewScene = [GameScene sceneWithSize:self.frame.size];
Upvotes: 1