skscene

How do I go from SKScene to UIViewController by code?

允我心安 提交于 2019-11-27 04:34:14
All I want if for when the user touches a skspritenode in the skscene, it will go to a different view like performseguewithidentifier . Thanks for any help. I can post code, but it seems like a generic question so I figured that you wouldn't need any. By the way, I already figured out how to detect the tapping the skspritenode. I have been looking at this for a long time and I am stumped. Please help. You cannot present a viewController from within a SKScene as it is actually only being rendered on a SKView. You need a way to send a message to the SKView's viewController, which in turn will

How to dismiss SKScene?

假如想象 提交于 2019-11-27 02:41:30
问题 When Im finished with my SKScene is there a way to dismiss the SKScene from within my SKScene class? If not back in my Viewcontroller where I present my SKScene [skView presentScene:theScene]; is there a way to restart the scene or remove in from my SKView? The SKScene Class Reference and SKView Class Reference are no help. Update: The following code removes my scene from my SKView [yourSKView presentScene:nil]; but when Im back in my view controller the scene is still running in the

Pausing a sprite kit scene

↘锁芯ラ 提交于 2019-11-26 22:53:42
问题 @property (SK_NONATOMIC_IOSONLY, getter = isPaused) BOOL paused; I found this line of code that I could add into my project, how would I pause my whole game? For example: -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ for (UITouch *touch in touches) { SKSpriteNode *pause = (SKSpriteNode*)[self childNodeWithName:@"pause"]; CGPoint location = [touch locationInNode:self]; // NSLog(@"** TOUCH LOCATION ** \nx: %f / y: %f", location.x, location.y); if([pause containsPoint:location

How to stop a audio SKAction?

吃可爱长大的小学妹 提交于 2019-11-26 22:01:20
问题 Goal: I want to present a new scene: [self.scene.view presentScene:level2 transition:reveal]; and end the current background music in order to start the new background music (the new background music from level 2). TheProblem: Upon presenting the new scene the background music of the 1. scene (level1) keeps playing and DOES not stop even when leaving the miniGame since the whole game consists of few mini games. The music played is an SKAction: @implementation WBMAnimalMiniGameLvL1 -(id

What's the best way to handle multiple SKScenes?

ぐ巨炮叔叔 提交于 2019-11-26 16:42:21
I made a game using the default new game project and then inserted a normal UIView as the app intro scene. I'vs since 'upgraded' the intro into using an SKScene, with buttons that push the original gameViewController onto the stack. It seemed a bit laggy once the gameview was loaded so I'm assuming that's to do with the overhead of having 2 full skscenes and view controllers. I even set the landing scene to pause, but it will obviously still use memory! My question is, how can I use an SKScene as the landing page (with it's own LandingViewController) and then efficiently add the

How to call method from ViewController in GameScene

点点圈 提交于 2019-11-26 13:54:11
问题 I have a method that has a custom segue in my viewController that looks like this: func gameOver() { performSegueWithIdentifier("GameOver", sender: nil) } I call the method like so in GameScene.swift: GameViewController().gameOver() I double checked the segue name and it is correct. Whenever I call this in my GameScene.swift file I get the SIGABRT message and I don't know why. I tried calling the function with only a println() message and it worked. Any advice on why this is occurring and how

How do I go from SKScene to UIViewController by code?

China☆狼群 提交于 2019-11-26 12:45:16
问题 All I want if for when the user touches a skspritenode in the skscene, it will go to a different view like performseguewithidentifier . Thanks for any help. I can post code, but it seems like a generic question so I figured that you wouldn\'t need any. By the way, I already figured out how to detect the tapping the skspritenode. I have been looking at this for a long time and I am stumped. Please help. 回答1: You cannot present a viewController from within a SKScene as it is actually only being

What's the best way to handle multiple SKScenes?

拟墨画扇 提交于 2019-11-26 04:54:39
问题 I made a game using the default new game project and then inserted a normal UIView as the app intro scene. I\'vs since \'upgraded\' the intro into using an SKScene, with buttons that push the original gameViewController onto the stack. It seemed a bit laggy once the gameview was loaded so I\'m assuming that\'s to do with the overhead of having 2 full skscenes and view controllers. I even set the landing scene to pause, but it will obviously still use memory! My question is, how can I use an