Variables, Operators, and Decisions: Animating Sprites
In this chapter, we will do quite a bit more drawing on the screen. We will animate some clouds that travel at a random height and a random speed across the background and a bee that does the same in the foreground. To achieve this, we will need to learn some more of the basics of C++. We will be learning how C++ stores data with variables as well as how to manipulate those variables with the C++ operators and how to make decisions that branch our code on different paths based on the value of variables. Once we have learned all this, we will be able to reuse our knowledge about the Simple and fast Multimedia Library (SFML) Sprite and Texture classes to implement our cloud and bee animations.
In summary, here is what is in store:
- Learning all about C++ variables
- Seeing how to manipulate the variables
- Adding clouds, a buzzing bee and a tree for the player to chop away at
- Random numbers
- Making...