Chapter 4. Exploring Movement and Input Handling

We have already covered drawing to the screen and how to handle objects but we have not had anything moving around very much yet. Getting input from the user and then controlling our game objects is one of the most important topics in game development. It can decide the feel and responsiveness of your game and is something that a user can really pick up on. In this chapter we will cover:

  • Cartesian coordinate systems
  • 2D vectors
  • Creating variables to control the movement of a game object
  • Setting up a simple movement system
  • Setting up input handling from joysticks, keyboard, and mouse
  • Creating a fixed frame rate

Setting up game objects for movement

In the previous chapter, we gave our objects x and y values ...

Get SDL Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.