O'Reilly logo

Beginning C++ Game Programming by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required