Questions tagged [skshapenode]

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

286 questions
2
votes
0 answers

SKShapeNode inside another one, limited by parent bounds

All right, so let's say I have two SKShapeNodes (or any SKNode related object), one is a circle, and the other is a square. I'm just trying to put the square inside the circle so it looks like this: However, if I simply add the Square Shape Node…
ThiagoAM
  • 1,432
  • 13
  • 20
2
votes
1 answer

Spritekit Line that follows the touch point

I want to draw the line from the bottom right corner of the screen to where the screen is touched using SpriteKit and update the line as the touch position changes. So there's only ONE line on the screen. I've tried creating a SKShapeNode and…
2
votes
1 answer

Smoothing Edges of Unstroked Paths on SKShapeNode

I've been doing some shape drawing using Swift's built in drawing tools to draw simple paths with straight lines. One anomaly I've noticed is that if you want a path that is filled but does not have a line stroke on its edge, it renders without…
Kwangle
  • 349
  • 2
  • 15
2
votes
1 answer

Why does SKShapeNode tear?

As a user traces along a line, a SKShapeNode path is built from line segments (which come from underlying 'tiles'). The actual path is built by locking in lines the user has previously dragged over, and finding the closest point on the closest line…
ReactiveRaven
  • 7,203
  • 2
  • 29
  • 38
2
votes
0 answers

How to get around u_path_length bug in iOS before iOS 10.2

The problem: On a device running a problematic iOS version, if u_path_length is even accessed it breaks the whole SpriteKit view - it just goes all black. The long explanation: There seems to be a bug with shaders in versions of iOS previous to…
Jonny
  • 15,955
  • 18
  • 111
  • 232
2
votes
0 answers

Matching node.fillColor (SKShapeNode)

I have 25 circles on screen each with a random colour that has been generated from the declared colours and each names 'CIRCLE_1', 'CIRCLE_2' etc. When matching the node.fillColor with the pre-defined colours, only the Yellow returns a value.…
Ryann786
  • 289
  • 4
  • 12
2
votes
2 answers

Folder of images: create and fill SKShapeNodes, 1 of each

Is it possible to create a folder and have SpriteKit go through that folder, find each image (regardless of name), and create a SKShapeNode for each in that folder (regardless of how many there are)? Assume all images are the same size, and all .png…
Confused
  • 6,048
  • 6
  • 34
  • 75
2
votes
1 answer

Swift: How to get the position of SKShapeNode?

I'm having trouble with SKShapeNode's position. I'm storing a path from user touch of screen. Then I create a polygon of that and put it into pathOfShapevariable. I create SKShapeNode of that path and everything works fine. I get the user drawn…
user594883
  • 1,329
  • 2
  • 17
  • 36
2
votes
1 answer

What's wrong with this SKShapeNode gradient coloring code?

I'm trying to create gradient colored SKShapeNode. I found the code below from theGoogle but it only works when color1 is black, e.g. defined as follows: CIColor.init(red: 0, green: 0, blue: 0, alpha: 1.0) The second color can be anything. enum…
user594883
  • 1,329
  • 2
  • 17
  • 36
2
votes
1 answer

circle from UIBezierPath drawn in wrong direction in SKShapeNode

Following UIBezierPath reference, I tried drawing a dashed path which should end up as dashed arc. However the drawing direction is wrong. clockwise was set to true but the top half of the circle was drawn as opposed to what was mentioned in the…
Gerald
  • 567
  • 1
  • 10
  • 17
2
votes
1 answer

Drawing line with SpriteKit and detecting collision

I have managed to draw a line with array of my random CGPoints. -(void)drawLine { SKShapeNode *mainLine = [SKShapeNode node]; CGMutablePathRef pathToDraw = CGPathCreateMutable(); CGPathMoveToPoint(pathToDraw, NULL, 0, 0); …
user3215624
  • 55
  • 11
2
votes
1 answer

How to handle touches in SKShapeNode subclass?

I'm looking for an easy way to handle touches inside an SKShapeNode Subclass. For that I tried to use touchesBegan, but it did not work.. class Shape: SKShapeNode { convenience init(rectOfSize: CGSize, colorOfRectangle rectColor: UIColor) { …
user3138007
  • 637
  • 1
  • 6
  • 19
2
votes
1 answer

How to draw a hollow circle with two different colors?

Im very familiar with drawing a filled createEllipseInRect shape node, but I was wondering if there's a way to do this programmatically. I want a circle thats split through the center with two separate colors on either side. I don't have code since…
KeepItSimple
  • 133
  • 8
2
votes
1 answer

Is it possible for a subclass of SKShapeNode ot use one of its convenience initializers?

I have a class that inherits from SKShapeNode because I want to add additional properties. The problem I am having is that I want to be able to create a "circle" by using SKShapeNode's "convenience" initializer…
malena
  • 798
  • 11
  • 26
2
votes
2 answers

How to create walls with SKShapenode?

I am trying to create walls in Swift using an SKShapenode. Even with the collision bit mask set to 'All', the characters still move through the rectangle and don't interact with it. Set up physics categories: struct PhysicsCategory { static let…
nick
  • 45
  • 7