Horizontally mirror a SKSpriteNode texture

Marti Serra Vivancos picture Marti Serra Vivancos · Oct 3, 2013 · Viewed 12.8k times · Source

I'm developing an iOS7 game with the new API called Sprite Kit. I'd like to horizontally rotated a SKSpriteNode image/texture. I've tried it by first mirroring the image, then creating a SKTexture and finally applying it to the SKSpriteNode but it doesn't work. Is there some way to do this? Or I should have to different images?

Answer

Greg picture Greg · Oct 3, 2013

If you're just trying to flip the sprite along an axis, you can do something like this:

sprite.xScale = -1.0;