Pyglet is a fun python interface for creating iteractive games. The purpose of pyglet_projects is to provide pyglet game examples for teaching and fun.
To get started you'll need python and pyglet. Probably the easiest way to get these requirements is to:
- install python
- install pip
- (optional) you may want to install virtualenv and install these within a virtual environment. Make sure you use python 3
- download this repo using either
git clone
or the download zip button above - install
pyglet
Now you're ready to dive in.
Note: python3 is suggested but not necessarily required. Some of the projects may work with python2.
This repo is organizes into directories for each example nested within the projects
folder.
|- pyglet_projects/
|- README.md
|- spinoff_projects.md
|- projects/
|- mind_sweeper_basic/
|- README.md
|- run.py
|- ...
|- snake_with_basic/
|- README.md
|- run.py
|- ...
|- ...
You should be able to go to any directory (sub-project) and run python3 run.py
to start the game.
I created a single repo for all these projects so it'd be easy for someone to download and try out a bunch of pyglet games.
Each project could concevable be it's on repo. I encourage you to start your own git repo, copy the project code over as a starting point, and modify to your hearts content. If you do, please add a link to spinoff_projects.md
and make a pull request. Share the fun!
One goal of pyglet_projects
is to be a learning tool for beginning developers. The projects have varying levels entry (e.g. some require knowledge of object oriented programming others do not). Because of this some projects have repeated implementations.
Courses often start teaching programming from the ground up with variables, control statements, and so on. I fully endorse this method. However, I know when I began programming some of the most valuable learning was from exploring existing projects.
Here are some general steps:
- start up a project and see how it works (these projects start with
python3 run.py
) - get a text editor (like Sublime Text) and open up the source code for the projects.
- modify the source code and run it again.
- go crazy, make modifications, and re-run it
- some good modifications are things like changing colors, object shapes, and control keys/buttons
Open source rocks! If you have an project idea to add to pyglet_projects
create a pull request! Projects must:
- run with
python3 run.py
- follow pep8