Skip to content

Files

Latest commit

 

History

History
23 lines (13 loc) · 1.06 KB

File metadata and controls

23 lines (13 loc) · 1.06 KB

Game programming is very rewarding nowadays and it can also be used in advertising and as a teaching tool too. Game development includes mathematics, logic, physics, AI, and much more and it can be amazingly fun. In python, game programming is done in pygame and it is one of the best modules for doing so.

Installing pygame: Pygame requires Python; if you don’t already have it, you can download it from python.org. Use python 3.6.1 or greater, because it is much friendlier to newbies, and additionally runs faster. The best way to install pygame is with the pip tool (which python uses to install packages). Note, this comes with python in recent versions. We use the –user flag to tell it to install into the home directory, rather than globally.

python3 -m pip install -U pygame --user

Once that’s done, you can verify the installation by running an example that comes with the library:

python3 -m pygame.examples.aliens

If it works, we are ready to go! Once you have installed pygame, you’re ready to create your very first pygame instance.