Questions tagged [skshapenode]

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

286 questions
7
votes
1 answer

SKAction change the color of a SKShapeNode

I am using the repeatActionForever method from SKAction to change the color of an SKShapeNode. Here's my code: SKShapeNode *ship = [SKShapeNode node]; [ship setPath:CGPathCreateWithRoundedRect(CGRectMake(-15, -15, 40, 17), 6.25, 6.25,…
raej2010
  • 117
  • 2
  • 9
6
votes
2 answers

how to create a circle with rounded ends for each quadrant

I have created a circle that is divided into quadrants. I am trying to make the ends of each quadrant rounded with a given gap between each quadrant, but I get some strange behavior. I guess I'm missing something. Below is an image of what I'm…
Hilarious404
  • 434
  • 3
  • 13
6
votes
1 answer

Draw a hole in a rectangle with SpriteKit?

How to draw a hole in a rectangle? I want to draw a rectangle which has a empty hole inside it and the background can be show. I am using SKShapeNode to create a rectangle, but I have no idea how to make a hole (circle) inside it. This is what I…
Yan-Jen Huang
  • 305
  • 1
  • 2
  • 8
6
votes
5 answers

Drawing dashed line in Sprite Kit using SKShapeNode

I fount this solution but I can't make it into swift code This what I try var pattern[2]:CGFloat; this var dashed: CGPathRef = CGPathCreateCopyByDashingPath(CGPathCreateCopyByDashingPath(path, transform, phase, lengths, count); var myShapeNode:…
user4460910
6
votes
2 answers

Drawing dashed line in Sprite Kit using SKShapeNode and CGPath

I want to draw a dashed line in my sprite kit game, I can use SKShapeNode node to draw a normal line like the following: UIBezierPath *_path=[UIBezierPath bezierPath]; //1 CGPoint point1 = CGPointMake(100,100); CGPoint point2 =…
Androyal
  • 893
  • 8
  • 7
5
votes
1 answer

Better to make SKShapeNode or SKSpriteNode in spritekit game?

I make a game in spritekit, so make a some things in SKShapeNode and of course use SKSpriteNode's in my game. Which is better for fps and good for optimization of this game using SKShapeNode's or SKSpriteNode's?
Nurassyl Nuridin
  • 444
  • 4
  • 13
5
votes
1 answer

Rotate a SKShapeNode with texture

I'm trying to rotate an SKShapeNode with a texture, but it's not working. Basically, I have a circle with a texture and I'm trying to make it rotate using the same way I have done with an SKSpriteNode: let spin =…
Anton O.
  • 653
  • 7
  • 27
5
votes
4 answers

Write a text in a circle in Sprite kit (swift)

i want draw a circle and put a text in it. what can i do? If i moved or resized the circle , text move or resize too var color = UIColor(red: 0x00, green: 0x44, blue: 0x44, alpha: 1) var Circle = SKShapeNode(circleOfRadius: 100 ) …
nmokkary
  • 1,219
  • 3
  • 14
  • 24
5
votes
1 answer

swift: converting SKShapeNode into SKSpriteNode -> No texture

I'm trying to convert SKShapeNode into a Sprite node by first converting the SKShapeNode into a texture. However the results is invisible sprite. The Physics body is there normally but no graphics are being displayed. Something wrong with the way I…
user3673836
  • 591
  • 1
  • 9
  • 23
5
votes
2 answers

Resizing a SKShapeNode

How do I resize a SKShapeNode? What I've tried so far: Frame resize box.frame.width = 10 Gives the error Cannot assign to the result of this expression SKAction let actionResize = SKAction.resizeToWidth(10, duration:…
Oskar Persson
  • 6,605
  • 15
  • 63
  • 124
5
votes
1 answer

Swift: detecting intersection from sprite kit SKShapeNode drawings

I'm drawing with Sprite Kit. I would like to detect when user's drawings are intersecting. I tried to following code but it doesn't work. It seems sprite kit is not saving all the points: override func touchesMoved(touches: NSSet, withEvent event:…
user3673836
  • 591
  • 1
  • 9
  • 23
5
votes
4 answers

Fill SKShapeNode with pattern image

I'm trying to fill a SKShapeNode with an Image/pattern but I'm still unsuccessfull. Can you help me solving this or giving me an alternative? I want to create a collidable custom shape (from any SpriteKit kind) filled with a pattern image. I've…
4
votes
0 answers

Use an SKShapeNode for the mask of an SKCropNode (Swift)

How can I use an SKShapeNode for the mask of an SKCropNode? My code currently creates an SKShapeNode circle and then sets the crop node mask to it shapeNode = SKShapeNode(circleOfRadius: 50) shapeNode.fillColor = UIColor.red shapeNode.lineWidth =…
E. Huckabee
  • 1,788
  • 1
  • 13
  • 29
4
votes
3 answers

Round Specific Corners - SKShapeNode

I have a SKShapeNode which needs to have each one of it's corners rounded if a specific condition is met. Reading the answer provided from the link below, this seemed quiet easy, as I would simply use |= to rounded addition corners that required…
Jarron
  • 1,049
  • 2
  • 13
  • 29
4
votes
4 answers

Swift: Make translucent overlapping lines of the same color not change color when intersecting

Currently I have drawn 2 lines on the screen which are the same color but both have an alpha value less than 1. When these lines intersect, the intersection is a different color than the rest of the lines. There was a previous post addressing the…
J.Treutlein
  • 963
  • 8
  • 23
1
2
3
19 20