sprite-kit

Create \(Use) SKView as \(in a) factory \(static class)

≯℡__Kan透↙ 提交于 2019-12-29 08:26:17
问题 I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() ->

Create \(Use) SKView as \(in a) factory \(static class)

若如初见. 提交于 2019-12-29 08:26:09
问题 I want to make an SKView I can use as a factory to make SKShapeNodes and "render" them to textures. But I can't find how I would initialise such a thing, and am having no luck, at all. How do I make a standalone SKView for this purpose? Or is there a better way to do this that avoids using the gamescene? Here's my FUTILE Effort at making a factory, this complains that texture(from: ) is ambiguous . I have no idea what that means. import SpriteKit class Make: SKView{ static func circle() ->

SpriteKit - how to correctly pause and resume app

血红的双手。 提交于 2019-12-29 06:56:24
问题 I have huge issue with my newest game for iPhone made with Games by Tutorials book's help. NOTE : method from SpriteKit- the right way to multitask doesn't work. So, in my ViewController.m file, I'm defining private variable SKView *_skView. Then, I do something like this : - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; if(!_skView) { _skView = [[SKView alloc] initWithFrame:self.view.bounds]; _skView.showsFPS = NO; _skView.showsNodeCount = NO; // Create and configure the scene

How to perform segue from within a SKScene?

坚强是说给别人听的谎言 提交于 2019-12-29 01:33:09
问题 I have been trying to perform a segue from within a sprite kit SKScene layer. My application requires the user to touch an image on the scene that would push up a new UIViewController. But every time I try to perform from within the SKScene game layer, it gives me output with has no segue with identifier error. I do have a segue and have specified it with an identifier. My simple question, how can one perfrom segue with a SKScene game layer running? Please help me out. 回答1: Segues belong to

Is it possible to deactivate collisions in physics bodies in spriteKit?

元气小坏坏 提交于 2019-12-28 17:33:13
问题 I'm looking at doing the best way to collect items with my hero in my spriteKit game for iOs, and after to try a few ways to do it, my conclusion is the best way would be to have an item with a physic body which can detect collisions but don't collide with my hero. Is it possible to do it? to deactivate collisions of a physic body without deactivating its capabilities to detect collisions?? Sounds a bit contradictory I know... Because, the other way would be to create only a SKSpriteNode

Is it possible to deactivate collisions in physics bodies in spriteKit?

爷,独闯天下 提交于 2019-12-28 17:31:18
问题 I'm looking at doing the best way to collect items with my hero in my spriteKit game for iOs, and after to try a few ways to do it, my conclusion is the best way would be to have an item with a physic body which can detect collisions but don't collide with my hero. Is it possible to do it? to deactivate collisions of a physic body without deactivating its capabilities to detect collisions?? Sounds a bit contradictory I know... Because, the other way would be to create only a SKSpriteNode

Stop SKAction that RepeatsForever - Sprite Kit

给你一囗甜甜゛ 提交于 2019-12-28 15:13:08
问题 I want to run two animations on my spriteNode depending on its rotation. If the value is negative run one of the animations, if it's positive run the other. And I managed to do that (kind of) but I have a problem. If Animation1 is running, and zRotation changes to positive, they both run because they are repeating forever. So I did this : NSMutableArray *walkingTextures = [NSMutableArray arrayWithCapacity:14]; for (int i = 1; i < 15; i++) { NSString *textureName = [NSString stringWithFormat:@

Stop SKAction that RepeatsForever - Sprite Kit

做~自己de王妃 提交于 2019-12-28 15:12:31
问题 I want to run two animations on my spriteNode depending on its rotation. If the value is negative run one of the animations, if it's positive run the other. And I managed to do that (kind of) but I have a problem. If Animation1 is running, and zRotation changes to positive, they both run because they are repeating forever. So I did this : NSMutableArray *walkingTextures = [NSMutableArray arrayWithCapacity:14]; for (int i = 1; i < 15; i++) { NSString *textureName = [NSString stringWithFormat:@

What is the right way to create scrollable table in SKSpriteKit?

只愿长相守 提交于 2019-12-28 13:55:32
问题 I need a way to display a leaderboard - best user scores (local user, local scores). Do I need to create my "own" node for this kind of thing, or its better to use UITableView above SKView with transparent background? 回答1: An approach I use is: In the scene's didMoveToView: method, set up a UIScrollView instance. Set all the properties you need, and make sure to also set its delegate, set hidden=YES and add its panGestureREcognizer to the view gesture recognizer collection. In

How to make camera follow SKNode in Sprite Kit?

这一生的挚爱 提交于 2019-12-28 12:04:10
问题 I want to have background stationary with different objects (sprites and other objects). Player will be represented by center node that will move around the world. I want to have my camera pinned to central node, e.g. the world should move and the camera should stay stationary. How do I achieve that? 回答1: Something like this should help. I call the following from my didSimulatePhysics. -(void)centerOnNode:(SKNode*)node { CGPoint cameraPositionInScene = [node.scene convertPoint:node.position