O'Reilly logo

SDL Game Development by Shaun Mitchell

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

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