0
votes

I'm new to SpriteKit. When I drag and drop "Color Sprite" from object library to make a new node. It gives the correct size (as you can see in the image below). Here the parent is the main scene not the blue one.

enter image description here

But when I change the parent node from the main scene to any other node (like blue one in my case) the new node gets larger however it's width and height remain same (shown below).
enter image description here

EDIT:

I'm running Xcode 7 beta 3.

1
I don't understand, if the node gets larger then it must have a larger width/height? Unless maybe you are scaling your blue node? - Epic Byte
I haven't played with scaling yet but yes it seems there's a problem with the scaling. - Hadi
Now there's another issue. blue screen node has width 640 and it's clearly mentioned in Attributes Inspector but when I try to print width programmatically it shows zero, however shows correct x,y coordinates. - Hadi
Oh your running Xcode 7 beta, Sprite Kit tools are pretty buggy right now. I suggest you try it out in Xcode 6 to make sure that your not doing anything wrong. Hopefully they fix the editor in the next beta. - Epic Byte

1 Answers

0
votes

I prefer you to do everything programmatically in sprite kit. I didn't understand what is going on there actually but if you want to make a shape like this, you should use SKShapeNode. SKSpriteNode is generally for making a node with a texture and animating that stuff etc...

//for example

let node = SKShapeNode(rectOfSize:CGSize(width:100,height:100))
node.position = CGPoint(x:500,y:350)
node.fillColor = UIColor.redColor()
self.addChild(node)

if you still have problems with the size, you can play with;

// for example;
node.xScale = 469
node.yScale = 300