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.
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 called spr_alien
, which should be an image of an alien, also seen from above. Use this sprite to represent obj_alien
. You'll need a controller object to spawn aliens, so we'll call it obj_alien_controller.
To make this more of a game, let's create...