Book Image

SFML Blueprints

Book Image

SFML Blueprints

Overview of this book

Table of Contents (15 chapters)
SFML Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building animations


In all our previous games, all the different entities displayed on the screen were static; at least they were not animated. For a more attractive game, the simplest thing to do is add some animations and different entities on the player. For us, this will be applied on the different buildings and warriors.

As we use a sprite-based game and not real-time animation based on bone movement, we need some textures with the animations that are already prepared. So, our textures will look as shown in the following figure:

Note

Note that the green grid is not a part of the image and is only shown here for information; the background is transparent in reality.

This type of texture is called a sprite sheet. In this example, the image can be split in two lines of four columns. Each line represents a direction of movement, namely left and right. Each cell of these lines represents a step of the future animation.

The aim of the work for this part is to be able to display a sprite using...