Does Sprite Kit have an equivalent to 9 slice scaling for sprites?
I have tried googling, but not finding anything, but... it's often a feature that goes by different names in different frameworks. So I could be missing it.
SpriteKit supports 9-slices.
https://developer.apple.com/library/ios/documentation/GraphicsAnimation/Conceptual/SpriteKit_PG/Sprites/Sprites.html#//apple_ref/doc/uid/TP40013043-CH9-SW10
The document doesn't tell you to set the size which won't work without it, so here it is:
SKSpriteNode *button = [SKSpriteNode spriteNodeWithImageNamed:@"stretchable_button.png"];
button.centerRect = CGRectMake(12.0/28.0, 12.0/28.0, 4.0/28.0, 4.0/28.0);
button.size = CGSizeMake(100.0, 50.0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With