O'Reilly logo

GameMaker Cookbook by Brandon Gardiner

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

Controlling a character with a mouse and keyboard

In the previous chapter, we looked at how to control your player character with a mouse, as well as a keyboard. I'm willing to bet you've played a game that required an input from both of these devices at the same time. You have, haven't you? I thought so. Let's take a look at a classic gameplay element that requires multiple inputs to shoot aliens.

Getting ready

We need a hero. Not an actual hero, mind you, but rather a player character who can run around onscreen and shoot things. For the purposes of this recipe, we'll use a static image of a guy with a gun, seen from the top. Let's turn it into a sprite called spr_player and use it to represent an object of the same name. You'll also need a sprite ...

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