Advertisement

Reacting to Player Input

  • Wouter van Toll
  • Arjan Egges
  • Jeroen D. Fokker
Chapter

Abstract

In this chapter, we will show you how your game program can react to mouse clicks and button presses. In order to do this, we need an instruction called if that executes an instruction (or a group of instructions) if a condition is met. We will show you how to formulate conditions for these instructions using Boolean values. We will also introduce enumerated types as another kind of primitive type. We will use the if-instruction to deal with keyboard and gamepad input in the Painter game.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2019

Authors and Affiliations

  • Wouter van Toll
    • 1
  • Arjan Egges
    • 2
  • Jeroen D. Fokker
    • 3
  1. 1.RennesFrance
  2. 2.UtrechtThe Netherlands
  3. 3.Department of Information and Computing SciencesUtrecht UniversityUtrechtThe Netherlands

Personalised recommendations