Questions tagged [skshapenode]

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

286 questions
4
votes
1 answer

Swift 3 (SpriteKit): Aligning SKPhysicsBody to SKShapeNode

I am creating SKShapeNodes in my program using this: let points = [CGPoint(x: x, y: y), CGPoint(x: x2, y: y2)] let line = SKShapeNode(points: &points, count: points.count) The problem that I am having is that whenever I add a physicsBody to the…
J.Treutlein
  • 963
  • 8
  • 23
4
votes
1 answer

No bouncing occurs when dragging an object to collide with another object in Sprite Kit

Here is a video of the issue I am having. As you can see in the video, I move a gray ball to try and collide with a red ball. When the two objects collide no bouncing occurs, the red ball just moves. I've tried playing around with the densities of…
Sami
  • 579
  • 5
  • 25
4
votes
1 answer

SpriteKit -- Change SKShapeNode Size

I have a SKShapeNode created by shapeNodeWithRect: cornerRadius:. This rounded rect is a child of an SKEffectNode so I can set shouldRasterize = YES. I'd like to change the width of this node based on the user's touch. i.e. As they move their finger…
rizzes
  • 1,532
  • 20
  • 33
4
votes
0 answers

Does SKShapeNode still leak memory?

There is plenty of info about all the problems with SKShapeNode in iOS 7. Memory Leak in Sprite Kit Application http://sartak.org/2014/03/skshapenode-you-are-dead-to-me.html Have all these issues actually been resolved in iOS 8? There aren't any…
thekwiat
  • 314
  • 3
  • 9
4
votes
1 answer

Drawing a line with SKShapeNode

I want to simply draw a line using SKShapeNode. I am using SpriteKit and Swift. Here is my code so far: var line = SKShapeNode() var ref = CGPathCreateMutable() override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { for…
PoisonedApps
  • 716
  • 8
  • 21
4
votes
1 answer

SKShapeNode frame contains point (0, 0) even if CGPath does not

I am implementing a game which loads background graphics dynamically, depending on currently visible area. The background is drawn with using SKShapeNode. In order to save memory, I am drawing only a small part of the CGPath. The problem is that no…
jakubr
  • 305
  • 1
  • 8
4
votes
3 answers

Touch through a node in SpriteKit

So I am working on making a tower defense game and have the tile board working and able to place towers... to a degree. When a player clicks a button above the grid, it will toggle on the tower placement and allow the player to place towers on a…
Klutch
  • 171
  • 1
  • 2
  • 13
4
votes
2 answers

SKshapenode is not responding to Physicsbody

I have created a SKShapeNode and I have assigned a physicsBody to it. However, it is not being triggered when there is contact. Creation of SKShapeNode code: -(SKShapeNode*)gravityline{ //SKSpriteNode *lolo=[[SKSpriteNode alloc]init]; …
TALAA
  • 6,184
  • 1
  • 13
  • 21
3
votes
2 answers

Need help understanding interaction between convenience initializer and instance variable unwrapping in Swift

I'm pouring over the Swift documentation about initializers and unwrapping and I'm failing to grok something fundamental about the way this works. Goal: I'd like to subclass SKShapeNode and use let reverse : Bool to define an instance variable that…
thebossman
  • 4,598
  • 11
  • 34
  • 45
3
votes
1 answer

best way to detect if node touch the frame

Im building some game with SpriteKit that include balls as SKShapeNode. I create a class that define the balls and their properties (including SKPhysicsBody). the balls should run on the screen, and the frame is the screen border (by using…
omerc
  • 179
  • 1
  • 11
3
votes
1 answer

How to rotate SKLabelNode in company with its parent SKShapeNode?

When press the screen, balls created with the following codes: var n = 1 func addBall(_ x:CGFloat){ let numShape = SKShapeNode(circleOfRadius: 30) numShape.name = "ball" numShape.position = CGPoint(x: x, y: frame.maxY-40) …
jdleung
  • 1,088
  • 2
  • 10
  • 26
3
votes
1 answer

Inherit SKShapeNode

Why it's possible to instantiate a SKShapeNode like this let circle = SKShapeNode(circleOfRadius: 10) But when i want to create a class that inherit form SKShapeNode i cant do something like this: public class Player:SKShapeNode{ public var…
GGirotto
  • 848
  • 2
  • 10
  • 31
3
votes
3 answers

Swift SpriteKit Rotate Node at x-axis

i am following this tutorial (i think it is written in JavaScript): 3D Terrain Im trying it in Swift with SpriteKit but have a problem with the rotation at the x-axis. So this is what it looks like in the tutorial: And this is where i am now: I…
aignetti
  • 481
  • 1
  • 3
  • 14
3
votes
0 answers

Set SKShapeNode frame to calculateAccumutedFrame

This issue has been happening for days: I cannot set the specific frame I need. I need my SKShapeNode frame to be the bounding box around a circle so that it is an inscribed circle to the frame. The blue is the current frame and the red is the…
ngngngn
  • 579
  • 4
  • 18
3
votes
2 answers

Small, "bouncy" lags when pushing an SKShapeNode with another shape moved by an SKAction

I am creating a 2D autoscroller and when my player (with a circle physicsBody) collides with an SKAction moveTo-powered obstacle which is moving towards it, it makes small, almost unnoticable lags. I tried lowering the friction and the density of…
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
1 2
3
19 20