Questions tagged [skshapenode]

An SKShapeNode object draws a shape defined by a Core Graphics path

286 questions
0
votes
0 answers

SpriteKit issue: "does not have a member named AddChild"?

I am building an app using circles. I'm fairly new to iOS programming, and I'm digging into SpriteKit. I found a code sample here: func circlePhysicsDefault() { var Circle = SKShapeNode(circleOfRadius: 40) Circle.position = CGPointMake(500,…
user1186742
  • 389
  • 2
  • 9
  • 14
0
votes
0 answers

Problems moving a ShapeLayer behind an SKNode in SpriteKit

I have built an animation using a CAShapeLayer (thanks to help from here) I'm using spritekit for the app and I need to ensure that the shapelayer appears behind the nodes on the screen. Is there any way of doing this as zPosition doesn't seem to…
0
votes
0 answers

straight line node in sprite kit is not showing

Im trying to add a straight line in sprite kit, so far I haven't find any problem in my code but when I run the app the node count stays at 0 and it doesn't displays any errors. I been stuck for hours... any clues? do I have to create a separate…
0
votes
1 answer

Xcode, SKSpriteKit, can't draw quadrilateral

I'm using Xcode, SKSpriteKit and am creating a game. I need my program to draw a quadrilateral in a function. -(void) DrawQuad { //Draw Quadrilateral here with points (a,b), (c,d), (e,f), (g,h) } I have already tried other links/help…
user4790859
0
votes
1 answer

Check if SKShapeNode which is a Line contains Point

I'm programming a little Game. For this I need some Walls. Therefor I have used: Wall[w] = [[SKShapeNode alloc] init]; Wall[w].path = WallPos[w]; Wall[w].lineWidth = 4; Wall[w].strokeColor = [UIColor whiteColor]; …
0
votes
1 answer

Spritekit Swift SKShapeNode Not Appearing

I am trying to put a rectangle in my game and it isn't showing up. Here is where I declare it and other important variables. var rect1: SKShapeNode! = SKShapeNode() var blackColor = (SKColor(red:0.00, green:0.00, blue:0.00, alpha:1)) var…
Aidan Kaiser
  • 501
  • 5
  • 17
0
votes
1 answer

detecting touch on SKShapeNode doesn't work the same way as with sprites

I have a SKShapeNode and i set a name for it, but when i try to detect it in touch began it doesn't work the way you use with other sprites. override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { /* Called when a touch…
Abdou023
  • 1,654
  • 2
  • 24
  • 45
0
votes
0 answers

SKShapeNode is distorted when displayed within SKScene

I have created a SKShapeNode and added it to an SKScene in the following way: SKShapeNode *newShape = [[SKShapeNode alloc]init]; [newShape setPath:CGPathCreateWithRoundedRect(CGRectMake(0, 0, 120, 120), 8, 8, nil)]; newShape.strokeColor =…
Linda Keating
  • 2,215
  • 7
  • 31
  • 63
0
votes
1 answer

How to use paths to create a sprite

I am very new to SpriteKit, and unfortunately cannot find any resources online to find out how this works. Basically, I have tried to create a diamond (from other's questions and answers on here). This is what I have: let node = SKShapeNode() var…
0
votes
1 answer

Expanding SKShapeNodes with Joint

I have two SKShapeNode nodes that I want to be attached to each other. When I tap to perform an action I want the two nodes to expand their height and upon tapping again I want them to retract. The problem is that the two nodes aren't animating as…
Kyle Decot
  • 20,715
  • 39
  • 142
  • 263
0
votes
1 answer

How to store SKShapeNode to system defaults using NSUserDefault

Now I am working on an app based on SKScene. And I want to store some SKShapeNode to system defaults so user can still see them when reopening the app after it is totally closed. I store the SKShapeNodes in a NSMutableDictionary. I tried to store it…
0
votes
0 answers

Run SKAction on SKShapeNode inside update method

i hope i'm not missing something.I'm trying to run SKAction on my SKShapeNode inside my update method , i made a flag check that i will only enter once to the "if" statment , it's working on the DidMoveToView method but dosent on the update or in…
0
votes
1 answer

draw smooth curve from array of points swift

I'm working on an app in Xcode using swift and sprite-kit, and I have an array of points that are arranged in an ellipse. I'm wondering how I can draw a smooth white curve that connects the points of the array. I'm pretty sure it has something to do…
Nightman
  • 49
  • 1
  • 8
0
votes
2 answers

More nodes than I should

Everytime I add 1 SKShapeNode, my total number of nodes shown in the simulator increases by 2. Is this a normal behaviour or should I get rid of the extra nodes, and how ? I'm on xcode 6.1 and iOS 8.1 import SpriteKit class GameScene: SKScene…
Caetano
  • 25
  • 5
0
votes
1 answer

Swift SKShapeNode shapeWithSplinePoints

I am trying create a CGPath for a node to follow but when I have tried using SKShapeNode as defined in the actions and constants slide from 608_hd_best_practices_for_building_spritekit_games I get the error Extra argument 'count' in call. Any…
ubersnack
  • 512
  • 6
  • 19