0
votes

Is there a way to enlarge a sprite node without moving the position?

I would like to animate a node to 'swell up' to a six * 6, then bring it back down to normal size in an animation loop?

I have it hard coded in a state block, where i do not move the image, but simply change the size of the sprite to simulate blowing up, then reducing the size back to normal - like when a creature was being pumped up in dig-dug....

But i was hoping there was a way to accomplish this by using something like moveTo and the animateWithTextures routine for movement.

1

1 Answers

1
votes

is easy to do with the method scaleTo:duration: of SKAction

for example:

SKAction *big = [SKAction scaleTo:3 duration:0.5];
SKAction *small = [SKAction scaleTo:1 duration:0.5];

[node runAction:
        [SKAction repeatActionForever:
                     [SKAction sequence:@[big, small]]]];