Is there a way to visually see sprite kit’s SKPhysicsbody borderline?

For Objective-C & iOS < 7.1 In your ViewController.m find this code SKView *skView = (SKView *)self.view; skView.showsFPS = YES; skView.showsNodeCount = YES; After the last line add skView.showsPhysics = YES; Build and Run and you should see all the physics Body borderline i noticed that you add the shapeNode to self instead of the … Read more

Physicsbody doesn’t adhere to node’s anchor point

I wrote this to fix Apple’s lack thereof: use pathForRectangleOfSize:withAnchorPoint: to replace your call to bodyWithRectangleOfSize: whose brief documentation tells us the problem: “Creates a rectangular physics body centered on the owning node’s origin.” @implementation SKPhysicsBody (CWAdditions) + (CGPathRef)pathForRectangleOfSize:(CGSize)size withAnchorPoint:(CGPoint)anchor { CGPathRef path = CGPathCreateWithRect( CGRectMake(-size.width * anchor.x, -size.height * anchor.y, size.width, size.height), nil); return … Read more

Insert line break using SKLabelNode in SpriteKit

I dont think you can, here is a “hack” way to do it SKNode *nerdText = [SKNode node]; SKLabelNode *a = [SKLabelNode labelNodeWithFontNamed:@”Arial”]; a.fontSize = 16; a.fontColor = [SKColor yellowColor]; SKLabelNode *b = [SKLabelNode labelNodeWithFontNamed:@”Arial”]; b.fontSize = 16; b.fontColor = [SKColor yellowColor]; NSString *st1 = @”Line 1″; NSString *st2 = @”Line 2″; b.position = CGPointMake(b.position.x, … Read more

SKNode convertPoint toNode & fromNode confusion?

– (CGPoint)convertPoint:(CGPoint)point fromNode:(SKNode *)node This essentially is saying: convert a point expressed in another node‘s coordinate system into the caller’s(self) coordinate system. The key is that the point has to be expressed in the node’s coordinate system for this to work. If you are using a sprite’s position as the point, you will need to … Read more