-
Notifications
You must be signed in to change notification settings - Fork 14
Home
The purpose of the Simple Python Game Library is to give beginning Python coders a simple framework to make basic 2D games. It is intended as an alternative to Pygame. As it is built on the Turtle module, it has the same features and limitations of that module. It does not require any external libraries to be added.
Version 0.8.4
Updated set_keyboard_binding method to allow for any order of arguments. The original version was reversed from tkinter causing confusion. This approach maintains backwards compatibility.
Version 0.8.3
Added .set_background method
Updated SPGL_Demo2.py and renamed it as Debris (placed in its own game folder)
Version 0.8.2
Used platform module to determine the user's platform. This fixed an issue with sound playing on Mac OSX.
Version 0.8.1
In accordance with PEP8, the module name has changed to lowercase. Programs written for Version 0.7.1 and below are not compatible.
Added a new method to create a popup dialog to let the user choose a file.
- spgl.ask_open_filename()
Version 0.7
This was a major update to the structure of the code. The code is structured a bit more logically to facilitate importing into the global namespace and to keep the code more consistent. Programs written for Version 0.6 and below are not compatible with this version.
There are 2 ways to import the code:
1) Keep a separate namespace
import SPGL
class Player(SPGL.Sprite):
def __init__(self, shape, color, x, y):
SPGL.Sprite.__init__(self, shape, color, x, y)
# Initial Game setup
game = SPGL.Game()
# Keyboard Binding
game.set_keyboard_binding(SPGL.KEY_UP, player.accelerate)
2) Import into the global namespace
from SPGL import *
class Player(Sprite):
def __init__(self, shape, color, x, y):
Sprite.__init__(self, shape, color, x, y)
# Initial Game setup
game = Game()
# Keyboard Binding
game.set_keyboard_binding(KEY_UP, player.accelerate)
Version 0.6
SPGL.py
SPGL Class
- Added error logging
- Added basic button class
- Added method for clicking on the screen
- Simplified .load_data method
- .print_game_info() shows more information, including error logs
- Added default splash screen
- Added modal popups (ask_yes_no, show_info, show_warning)
Sprite class
- init can now take image file (.gif only) as shape argument (along with width and height arguents)
Label class
- Labels stored in Game.labels and automatically updated each tick
Button class
- Simple button class added
Version 0.5
A way to save and load data added .save_data(key, value) .load_data()
More work on the Splash Screen Done (Not finished yet)
Version 0.4
Added a basic Label class for adding text to the screen. Small engine improvements (turtle.setundobuffer(0))
Version 0.3
Initial version with basic game framework and Sprite class.
- Subscribe to my YouTube Channel.
- Follow me on Twitter - @tokyoedtech.
- Check out my blog.