Chapter 2. Variables, Operators, and Decisions – Animating Sprites

In this chapter we will do quite a bit more drawing on the screen and to achieve this we will need to learn some of the basics of C++.

Here is what is in store:

  • Learning all about C++ variables
  • Seeing how to manipulate the values stored in variables
  • Adding a static tree, ready for the player to chop
  • Drawing and animating a bee and three clouds

C++ variables

Variables are the way that our C++ games store and manipulate values. If we want to know how much health the player has then we need a variable. Perhaps you want to know how many zombies are left in the current wave? That is a variable as well. If you need to remember the name of the player who got a particular high score, you guessed ...

Get Beginning C++ Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.