Create a 2D shooter

OUR EXPERT
Calvin Robinson is a former Assistant Principal and Computer Science teacher with a degree in Computer Games Design and Programming BSc (Hons).

We’re going to have a go at creating our own 2D shooter. We’ll be using Python for this tutorial, so make sure it’s installed and updated, along with the PyGame module. pip3 install pygame should get everything set up. We’ll need some image and sound resource files which can be downloaded from the LXF archives website, along with a complete copy of the source code for reference.
Launch Python IDLE and select File > New File to create a new document in the Script window. It’s important to type code in the Script window, rather than Shell, because it’s then editable and saveable.
We’re going to start off by importing PyGame, since this module provides a lot of game mechanics that we’ll want to tap into. We’ll also initialise our game world ( init ) and set the screen resolution:

Now that we have a working game environment, we’ll need to start adding things to it. Let’s begin with our player
You're reading a preview, sign up to read more.
Start your free month