Welcome to part 2 of my introduction to the Python programming language.
The focus of this part will be on making some simple computer games through the use of a graphical library known as Pygame. To proceed with this section, you will need Python running on your own computer with a proper editing program such as Jetbrains Pycharm. Fortunately, Jetbrains make a community edition version of the product the release for free.
- Get Pycharm here: https://www.jetbrains.com/pycharm/
- Install PyCharms if you don’t already have it on your computer (my students should have it installed automatically by IT)
- Start Pycharms and create a new project (I recommend creating a new folder for all your Python programs)
- Install the Pygame library following the instructions I provide in class. I won’t include it in this handbook as the instructions might change when Pycharm updates, and are also slightly different for Windows vs Macs.
Pygame is a graphics system for Python. The screen is divided into pixels. You use sets of pixel coordinates to tell Python where to draw shapes, place text or images etc.
Pygame coordinates start with the top-left of the screen being (x=0,y=0).
The x-axis increases as you move to the right.
The y-axis increases as you move down – this is different to the way you do it in Maths so be aware of that!