Game Development Reference
In-Depth Information
Multiple animations
Creating a single animation seemed quite straightforward, didn't it? With multiple anima-
tions, things are not much more complicated. Let's have a scenario where we have two tex-
tures— spriteSheet.png and myTexture.png , and we want to have four anima-
tions, each of which uses one of these textures. Here is how the setup might look like:
Note all the different ways in which we can create animations. We are not limited to time,
texture, name, number of frames, or even frame locations. We can even add frames one by
one from the texture, by calling Animation::AddFrames() with 1 as the last para-
meter. Having many animations is definitely a nice thing to have, however, we need a way
to switch between them. The following code demonstrates how to go between animations
on key press events:
Search WWH ::




Custom Search