< Previous | Contents | Next >

Performing Arithmetic Operations with Variables

Once you have variables with values, youll want to change their values during the course of your game. You might want to add a bonus to a players score for defeating a boss, increasing the score. Or you might want to decrease the oxygen level in an airlock. By using operators youve already met (along with some new ones), you can accomplish all of this.


 

Introducing the Game Stats 2.0 ProgramAltering the Value of a VariableUsing Combined Assignment OperatorsUsing Increment and Decrement OperatorsDealing with Integer Wrap Around