An SKShapeNode object draws a shape defined by a Core Graphics path
Questions tagged [skshapenode]
286 questions
3
votes
3 answers
How to detect precisely when a SKShapeNode is touched?
I'm working with Swift and SpriteKit.
I have the following situation :
Here, each of the "triangles" is a SKShapenode.
My problem is that I would like to detect when someone touches the screen which triangle is being touched.
I assume that the…

Drakalex
- 1,488
- 3
- 19
- 39
3
votes
1 answer
Assigning an image to a SKShapeNode as a Ball - Spritekit Game
I am trying to add an image to my ball in my Swift 2 Sprite-kit game. I have a make() ball function and it there are no errors there however in the game scene, when the method is called, I keep receiving this error :
"Cannot assign SKShapeNode' to…

N. Howey
- 119
- 7
3
votes
1 answer
Making SKLabelNode as a crop node of SKShapeNode
Can't find in web, how to make SKLabelNode cropping SKShapeNode. When i colorize the background, my goal is colorize the label too with the same method, so both of them have to colorize simultaneously. But can't imagine how to crop SKShapeNode with…

Nurassyl Nuridin
- 444
- 4
- 13
3
votes
1 answer
Is that possible to tile texture SKShapeNode
I am working with Sprite Kit and made a SKShapeNode using bezier path.
Drawing the path is working good.
Then I want to texture the shape node using fillTexture.
SKTexture *tex = [SKTexture textureWithRect:CGRectMake(0, 0, 20, 20)…

farhad
- 31
- 2
3
votes
1 answer
Why are SKShapeNode brighter on the top border
Im just want to know why these SKShapeNode are behaving this way. I tried setting sprite.lineWidth and sprite.glowWidth to 0 but can't get them to display evenly. However this doesn't happen when having them all display using…

C. Wagner
- 461
- 7
- 13
3
votes
1 answer
SpriteKit Swift Node Count issues
The simulator shows the node count, that there are 2 nodes. But why is that? Since there is only one var(ball). Is there a way to create a circle without having it be double the nodes.
class GameScene: SKScene {
var ball =…

Miles Militis
- 147
- 1
- 7
3
votes
0 answers
Set color of SKShapeNode
I have an SKShapeNode, defined by a circleWithRadius. When I try to modify the color of node with node.fillColor, gets filled the entire area around the circle, not just the area defined by circle path. My question is: how can I fill just the inner…

Alec Firtulescu
- 543
- 6
- 18
3
votes
2 answers
SKShapeNode not drawing UIBezierPath
Calling this code inside the didMoveToView() of my SKScene:
let frame = CGRect(x: 30, y: 200, width: 100, height: 100)
let path = UIBezierPath(rect: frame)
UIColor.blackColor().setStroke()
path.stroke()
self.addChild(SKShapeNode(path:…

Youssef Moawad
- 2,846
- 5
- 28
- 50
3
votes
2 answers
Changing the image of a SKSprite to an SKShapeNode
Sprite Kit, Xcode.
I need to find a way to change a sprites image within the program itself. I know how to create jpg files and make them into the sprite image...
But for this program, I need to draw circles/polygons (which may change inside the…
user4790859
3
votes
2 answers
Dragging of SKShapeNode Not Smooth
So I am super new to swift and iOS development but not totally new to programming, and was just going through some tutorials, but basically my code looks like this:
import SpriteKit
class GameScene: SKScene {
override func didMoveToView(view:…

Joe B
- 81
- 7
3
votes
2 answers
SKShapeNode consuming too much memory and slowing down animation -Spritekit iOS
I am using SKShapeNode to to create a mountain like object . I use CGMutablePathRef to give the points to my path
SKShapeNode *shapenode = [[SKShapeNode alloc] init];
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 0,…

Shikha Shah
- 753
- 3
- 12
- 34
2
votes
2 answers
Swift, SpriteKit: Low FPS with a huge for-loop in update method
Is it normal to have very low FPS (~7fps to ~10fps) with Sprite Kit using the code below?
Use case:
I'm drawing just lines from bottom to top (1024 * 64 lines). I have some delta value that determines the positions of a single line for every frame.…

aibek
- 161
- 8
2
votes
0 answers
Weird blurred SKShapeNode
I am trying to start with the basics of SpriteKit and draw a rounded rectangle
import Foundation
import SpriteKit
class UINode: SKShapeNode {
override init() {
super.init()
self.path = UIBezierPath(roundedRect: CGRect(x: -5,…

StepheZ
- 21
- 1
2
votes
1 answer
How Can I Create a Dashed Line SKShapeNode from a UIBezierPath, Using Swift?
All of the explanations I've found seem to say the same thing. I can't figure out why this isn't working.
var linePath = UIBezierPath()
linePath.move(to: CGPoint(x: 50, y: 50))
linePath.addLine(to: CGPoint(x: 100, y: 100))
var pattern : [CGFloat]…

SuperCodeBrah
- 2,874
- 2
- 19
- 33
2
votes
1 answer
Recreating image from pixel data
I have the following code:
GameScene.swift
import SpriteKit
import GameKit
class GameScene : SKScene {
var circleHolder:CircleHolder = CircleHolder()
override func didMove(to view: SKView) {
self.addChild(circleHolder)
…

David
- 39
- 5