I have a button to pause game. The button is in GameViewController. I know how to stop the action of the character. But how can I use the button in GameViewController to stop the action of character in GameScene? Please help. Thanks
pause game
In your GameScene, all you have to write is self.isPaused = true
If you're calling that from the GameViewController, you'll need to retain a reference to the scene variable after you present it, so you can pause it later. But that should just be scene.isPaused = true
If you're looking to ONLY pause a character (not the entire scene), your best bet is to move the button into the GameScene (which I would recommend anyway), then it's as simple as writing... thePlayer.isPaused = true
Can you please give me the sample code how to call it from GameViewController? It's OK if it's in Swift. But it's better if you give me sample code in Objective C. Thanks
I've tried to declare GameScene class in GameViewController.h. I got two errors:"Unknown type name 'GameScene' " and "Property with 'retain (or strong)' attribute must be of object type". I "import"ed GameScene.h in GameViewController.h. Please help. Thanks