Skip to content

Examples of simple games using pyglet for fun and learning

Notifications You must be signed in to change notification settings

earthastronaut/pyglet_projects

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pyglet Projects

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.

Getting Started

To get started you'll need python and pyglet. Probably the easiest way to get these requirements is to:

  1. install python
  2. install pip
  3. (optional) you may want to install virtualenv and install these within a virtual environment. Make sure you use python 3
  4. download this repo using either git clone or the download zip button above
  5. install pyglet
    1. how to install pyglet for python3
    2. pyglet home
    3. pyglet install docs

Now you're ready to dive in.

Note: python3 is suggested but not necessarily required. Some of the projects may work with python2.

Pyglet Project Organization

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!

Explorative Learning

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:

  1. start up a project and see how it works (these projects start with python3 run.py)
  2. get a text editor (like Sublime Text) and open up the source code for the projects.
  3. modify the source code and run it again.
  4. go crazy, make modifications, and re-run it
    1. some good modifications are things like changing colors, object shapes, and control keys/buttons

Contributing

Open source rocks! If you have an project idea to add to pyglet_projects create a pull request! Projects must:

  1. run with python3 run.py
  2. follow pep8

About

Examples of simple games using pyglet for fun and learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages