I am creating a relatively complicated animation sequence. In it, a certain SKSpriteNode
(shark) does two rotations. At the beginning of the animation, it rotates around a certain anchor point ap1, then later rotates around a different anchor point ap2. How should I change anchor points midway through an animation sequence?
Some initial thoughts:
I could change the anchor point outside of SKAction
s, in the update:
loop perhaps.
I could use multiple SKSpriteNode
s for the same shark sprite (with their respective anchor points), switching (hiding/showing) the sprite nodes when I need to change the anchor point.
Since changing a sprite's anchor point affects where it's rendered, you will likely need to make some sort of adjustment to prevent the sprite from appearing to suddenly move to a new location. Here's one way to do that:
Create action that changes the anchor point
Run action to rotate, change the anchor point, and rotate
This method adjusts a sprite's position to compensate for the anchor point change