Game Development Reference
In-Depth Information
Introduction
Adding animations into our games using SpriteKit is an easy task, as we did in the previous
chapter, where we added some SKAction functions to get the spaceship to move. These
were the animations related to their movement, orientations, and somewhat related to their
transformations. However, now the animation that we are going to talk about is the content
change of a sprite. Animations will be animating multiple images (that is, frames) of the
same sprite multiple times per second, giving a feel of being alive for the sprite. This is
somewhat similar to the way we capture the videos, it's just a sequence of the snapshots per
second. These types of animations need a lot of images to be accomplished thereby increas-
ing the memory size for these textures. The texture is represented by a SKTexture object
created and attached with the sprite. Texture object automatically loads the sprite data
(called Texture data) whenever it is visible and is used to render the sprite in the respective
scene. And when the sprite is removed or not visible in the scene, it deletes the texture data,
and as a result automatic memory management is simplified.
Technically, all of this means that sprites have display frames, which have different textures
that change by a fixed delay between each frame. And everything we are going to do in the
starter and solution kit will be continued from where we left in the previous chapter.
Search WWH ::




Custom Search