O'Reilly logo

iOS Game Programming Cookbook by Bhanu Birani, Chhavi Vaishnav

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating your textures

In this recipe, we will look at how textures are created and attached to sprites. We will also do some content change (that is, frame changing animations) with the help of textures.

Getting ready

To get started with textures to be animated, we should know about scenes, nodes, and sprites. As sprites are created with an image and are added on scene, which occupies more memory, textures should be a solution to this problem.

How to do it...

As the images are stored in App Bundle, the simplest way to create a sprite with texture is to create the texture first and then the sprite using the same texture. At runtime, the images are loaded from the app bundle to become the texture and then the visible entity called sprite.

So in the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required