2

I'm wondering is it possible to scale parentNode without scaling it's childNode using spritekit? Because during game process i want to run scale action only for one part of the node(in my case its parent). So if somebody can help i'll be glad.

RootiK
  • 23
  • 4
  • as far as i know if you scale the parent then you automatically scale the child – hamobi Apr 24 '16 at 22:48
  • 1
    Not the child node will scale with the parent. However, when you scale your parent node, you could try simultaneously scaling your child by the reciprocal of the amount your are scaling the parent. – Steve Ives Apr 25 '16 at 08:05

1 Answers1

5

You can't scale a parent and not scale the child, you can always apply the opposite action to counter the scale, but this wastes CPU cycles and could throw off the scale factor depending on the math. Instead, what you should do is have a parent node that does not scale, and have 2 sibling nodes be children of this new parent instead of having the simple parent/child relationship. This way you can have 1 sibling scale without effecting the other sibling, and you still have the parent node to control the children.

Node structure should look like this

SKNode (new parent)
|--SKSpriteNode (old parent)
|--SKSpriteNode (old child)

Knight0fDragon
  • 16,609
  • 2
  • 23
  • 44