sprite-kit

Joints break when zooming

落爺英雄遲暮 提交于 2020-01-02 16:18:47
问题 I've been rehearsing Sprite Kit lately and I've come across a very strange problem. When zooming (changing the scale of) the parent node, bodies that are joined together by SKPhysicsJointPin separate from each other gradually and then joints break. Let me show you the images. This is for the normal state: Here's when zoomed in: And here's when zoomed out: If you ask how I join bodies: I join the brown sticks to the blue nodes on the center of the blue nodes. Any ideas what my problem is? EDIT

Sprite Kit game crashes on Game Over on tvOS 9.1 and iOS 9.2

自作多情 提交于 2020-01-02 16:14:49
问题 I have a Sprite Kit game that is crashing when the game is over. This happening on the tvOS 9.1 and iOS 9.2. Before, I had it running on iOS 9.1 without crashing. It seems to be an OpenGL issue, but when I search the function in Xcode, it doesn't come up with anything. Unfortunately, the error is not consistent in appearing in the console. Here's the error: Jet: draw_indexed: indexType must be 'unsigned_int' or 'unsigned_short' Assertion failed: (indexType == jet_component_type_unsigned_int |

sprite kit collision detection with child sprite

馋奶兔 提交于 2020-01-02 15:55:12
问题 I'm trying to detect collisions between two sprites but I'm unable to do this with a child sprite. self.player = [[Player alloc] initWithImageNamed:@"player"]; self.player.position = CGPointMake(150, 75); [self addChild:self.player]; _object = [SKSpriteNode spriteNodeWithImageNamed:@"object"]; _object.position = CGPointMake(-40, 27); [self.player addChild:_object]; then I have collision detetion like this - (void)checkCollisions { [self.map enumerateChildNodesWithName:@"enemy" usingBlock:^

Restarting Sprite - Kit Game Swift

不羁岁月 提交于 2020-01-02 14:12:14
问题 I have created a simple 2D arcade game using SpriteKit and I am trying to add a scoring system.Basically the game is a square sprite which has to jump over various obstacles. So what I want is when the player contacts the object for the whole game to restart. The game detects the contact (I tested it previously) but when I remove all my children and then run my game's basic main function I notice that old objects keep spawning and cluttering with each other. func didBegin(_ contact:

Why can't I add a SKScene to another SKScene?

℡╲_俬逩灬. 提交于 2020-01-02 07:13:36
问题 I'm trying to make this SKScene appear in the middle of the scene at the end of the game, so that the previous scene is still visible in the background (similar to that of the ending of flappy bird). This is an image of how I want it to appear: So far this is the code I've made: in the game scene: -(void)dieFrom:(SKNode*)killingDebris { _touched = YES; if (_touched == YES) { beatLevel = YES; NSLog(@"touched"); [self runAction:[SKAction sequence:@[ [SKAction runBlock:^{ [_goodSquare

How to remove node from parent if touched more than once?

僤鯓⒐⒋嵵緔 提交于 2020-01-02 07:01:44
问题 I am making a game in which bullets are shot to the bad guy when the button is pressed. I made a function in which whenever it is called it adds more bad guys. Here is the code: (This method is called multiple times) func BadGuyPosition() let BadGuyCircle = SKSpriteNode(imageNamed: "CircleBadGuy") BadGuyCircle.zPosition = 1 //var mininmum = self.size.width / 600 let TooMuch = self.size.height - 60 let PointToShow = UInt32(TooMuch) BadGuyCircle.position = CGPointMake(CGRectGetMaxX(self.frame)

How to remove node from parent if touched more than once?

半腔热情 提交于 2020-01-02 07:01:43
问题 I am making a game in which bullets are shot to the bad guy when the button is pressed. I made a function in which whenever it is called it adds more bad guys. Here is the code: (This method is called multiple times) func BadGuyPosition() let BadGuyCircle = SKSpriteNode(imageNamed: "CircleBadGuy") BadGuyCircle.zPosition = 1 //var mininmum = self.size.width / 600 let TooMuch = self.size.height - 60 let PointToShow = UInt32(TooMuch) BadGuyCircle.position = CGPointMake(CGRectGetMaxX(self.frame)

In Xcode 6 Beta 4 stroking with SKShapeNode doesn't work anymore

流过昼夜 提交于 2020-01-02 05:45:21
问题 In Xcode 6 beta 2 it worked fine, but in beta 4 it doesn't work anymore. Does anyone know what's behind this mystery? let circle = SKShapeNode(circleOfRadius: 125); circle.strokeColor = UIColor(red: 255, green: 255, blue: 255, alpha: 1.0); circle.lineWidth = 4 self.addChild(circle); In beta 4 nothing can be seen. Thanks for your help in advance. 回答1: This is a common issue with Xcode 6 Beta 4 when using the simulator. It renders fine when using an actual device . See this developer forums

Pause SpriteKit Scene When Clicking on iAds

夙愿已清 提交于 2020-01-02 04:42:08
问题 I am working on a SpriteKit project and I'm struggling to pause the game when the iAd is clicked, and unpause when the iAd is dismissed. The main problem is pausing the Scene from the ViewController, I know that if I want to pause the Scene from the Scene.m I should use the code self.scene.view.paused = YES; however this code doesn't work in the ViewController. - (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave { //pause game } - (void

Sprite Kit Physics Collision Issue

自古美人都是妖i 提交于 2020-01-02 03:47:06
问题 I'm having an issue with some collisions. I have two objects equal size and mass. When one collides into another that is at rest I get the correct behavior (grey area in image). When I have two objects that are next to each other the behavior isn't quite right. Spritekit result on the left. Expected/needed result on right. I think I know what is going on, but not sure what to do about it. If the object was one object with twice the mass then the spritekit behavior would be correct, but they