An SKShapeNode object draws a shape defined by a Core Graphics path
Questions tagged [skshapenode]
286 questions
0
votes
1 answer
Unable to add a convenience initialiser to an SKShapeNode subclass
Trying to add a convenience init to an SKShapeNode subclass generates two compiler errors:
class Shape : SKShapeNode {
convenience init(diameter: CGFloat) {
self.init(circleOfRadius: diameter / 2) // error: Use of 'self' in delegating…

Milos
- 2,728
- 22
- 24
0
votes
2 answers
Fill SKShapeNode created from CGPath
I'm trying to create a custom SKShapeNode based on an array of points.
The points form a closed shape and the shape ultimately needs to be filled.
This is what I've come up with so far, but for some reason the stroke draws fine but the shape stays…

Gerome Pistre
- 457
- 6
- 15
0
votes
1 answer
Best way to perform a touch moved hit with a SKShapeNode like with a baseball bat?
I want to hit a ball with a baseball bat which moves with the users finger movement.
I tried the following two methods:
(Bat = SKShapeNode(...))
1. - Use of didBeginContact and then applying the Velocity to the ball from the last…

Jonas
- 2,139
- 17
- 38
0
votes
2 answers
iOS app seems to think its width is half of what it really is
In my iOS swift app I have an instance where I am making a circle with SKShapeNode(circleOfRadius: 15) but it makes a skinny ellipse instead, the width is only half of what it should be to make a circle.
Also, when I try to put something in the…

Kevin
- 15
- 6
0
votes
1 answer
Continuously changing color property of SKShapeNode during gameplay (Swift)
I have an SKShapeNode var Circle = SKShapeNode(circleOfRadius: radius) in the background of my spritekit game that uses swift. The circle is for aesthetic purposes so nothing interacts with it. I'd like Circle.strokeColor to continuously change at…

Thomas Keegan
- 11
- 3
0
votes
1 answer
CGRectContainsPoint using shape opposed to frame
So we have our detection here
-(void)checkInFOVWithPlayer:(Player *)player andEnemy:(Player *)enemy {
SKNode *fovNode = [player childNodeWithName:player.playersFOVName];
SKNode *node = [self childNodeWithName:@"enemy"];
CGPoint…

Daniel
- 285
- 3
- 12
0
votes
1 answer
SKShapeNode with different rotate axis also with SKPhysicsBody swift
I am trying to create a SKshapenode which can rotate with hinge at the bottom like shape on left. But i want that to have its physicsbody where the visual shape is. The Physicsbody is always at the same where i have drawn in blue. Is there a way to…

vaidhya nathan
- 43
- 1
- 6
0
votes
1 answer
skshapenode adding two nodes?
I'm not sure whether there's an issue with the implementation or the way I'm using it.
However, it's presenting over 2,400 nodes when it should be ~ 1,250
-(void)drawWeb {
//get distance of 50 across
int distanceMargin =…

Daniel
- 285
- 3
- 12
0
votes
1 answer
How to draw a face to SKShapeNode
I'm fairly new to Swift and I'm coding for my kids. I'm using sprite-kit to create a simple game for them. At the moment I'm struggling with how to draw a face to an arbitrary skshapenode? I know that there is no holes within the shape but other…

user594883
- 1,329
- 2
- 17
- 36
0
votes
2 answers
SKShapeNode.Get Radius?
Is it possible to get an SKShapeNode's radius value?
The problem is, I need to create an identical circle after the user releases it, whilst removing the first circle from the view.
SKShapeNode *reticle = [SKShapeNode…

Daniel
- 285
- 3
- 12
0
votes
1 answer
How to CGPath or SKShapeNode Rotation
I want to add rotated elliptical paths to one center point. Like image below but random rotated elliptical.
Draw these elliptical orbits with,
roadShape = SKShapeNode(ellipseInRect: centeredRect)
roadShape.strokeColor =…

mert
- 1,090
- 13
- 26
0
votes
1 answer
White lines appearing in SKShapeNode line
I'm drawing a line using SKShapeNodes. This line is constantly "growing", or always moving up. When the user taps on the screen the line should change directions, right or left, at a 45 degree angle. It does this, however for some reason random…

Aaron
- 757
- 5
- 18
0
votes
1 answer
SKShapeNode is appearing wrong dimensions
I opened spritekit app sample and than added this code
override func didMoveToView(view: SKView) {
/* Setup your scene here */
var shapeNode = SKShapeNode(rect: view.frame)
shapeNode.strokeColor = UIColor.redColor()
…

mert
- 1,090
- 13
- 26
0
votes
2 answers
Add SKShapeNode in another one
I want to draw a square in another square; but I can't position the second one in the right way.
What can I do for positioning based on first square coordinates?
var tileBackground = SKShapeNode(rectOfSize: CGSize(width: screenWidth, height:…

nmokkary
- 1,219
- 3
- 14
- 24
0
votes
1 answer
iOS Spritekit intersectsnode does not work for SKShapeNode
I am using the iOS SpriteKit Game Swift template on iOS8.3. I am trying to use the function func intersectsNode(_ node: SKNode) -> Bool to detect overlap of two circles created as SKShapeNodes. Turns out the function does not detect the intersection…

nata11
- 109
- 1
- 8