PyGame Simplified — A beginner-friendly wrapper around Pygame
Project description
PyGame-S — PyGame Simplified
PyGame-S is a beginner-friendly wrapper around Pygame that simplifies game development without limiting what you can build. Write less boilerplate, focus more on your game.
Installation
pip install pygames-simplified
Importing
from pygames.advanced import * # Physics + Player + Animator(recommended)
from pygames.medium import * # Physics only (no player input)
Quick Start
from pygames.advanced import *
game = Game(800, 600, "My Game")
player = Player(game, 100, 300)
ground = SSprites(game, 0, 550, source=Surface((800, 50)))
ground.image.fill("green")
game.start(player)
game.make_solid(ground)
def logic():
game.background("skyblue")
player.tick()
game.mainloop(logic)
Complexity Tiers
| Import | What you get |
|---|---|
from pygames.medium import * |
Core engine + physics (no player input) |
from pygames.advanced import * |
Core engine + physics + controllable player + Animator |
Core — Game
game = Game(w=800, h=600, title="My Game", icon_path=None)
| Method | Description |
|---|---|
game.background(color) |
Fill the screen with a color each frame |
game.start(*objects) |
Register objects to be drawn and updated |
game.make_solid(*objects) |
Mark objects as collidable |
game.check_key_pressed(name) |
Check if a key is pressed — e.g. "left", "space", "w" |
game.start_score_counter() |
Display score on screen |
game.score |
Set or update the score value |
game.start_garbage_collecter() |
Auto-remove off-screen objects |
game.load_image(name, path) |
Load an image by name |
game.img(name, x, y, w, h) |
Draw a loaded image |
game.load_sound(name, path) |
Load a sound by name |
game.play_sound(name) |
Play a loaded sound |
game.set_speed(fps) |
Set target FPS (default 60) |
game.zoom(factor) |
Resize the window by a multiplier |
game.mainloop(logic) |
Start the game loop |
game.create_surface(width, height, color, alpha) |
Create a surface |
Base Sprite — SSprites
obj = SSprites(game, x, y, image_path=None, source=None)
The base class for all game objects. Accepts an image path, a raw Surface, or defaults to a white square.
| Method | Description |
|---|---|
obj.draw() |
Draw the object to the screen |
obj.move(dx, dy) |
Move the object by an offset |
Physics — PhysicSprite (medium)
obj = PhysicSprite(game, x, y, width=50, height=50, color="red")
Extends SSprites with gravity, collision, and velocity.
| Attribute | Description |
|---|---|
obj.vel_x |
Horizontal velocity |
obj.vel_y |
Vertical velocity |
obj.gravity |
Gravity strength (default 0.8) |
obj.max_fall_speed |
Max fall speed to prevent tunnelling (default 20) |
obj.on_ground |
True if standing on a solid |
| Method | Description |
|---|---|
obj.apply_physics(solids) |
Apply gravity and collision — called automatically |
obj.jump(force=15) |
Jump if on the ground |
Player — Player (advanced)
player = Player(game, x, y, width=40, height=60, color="blue", speed=5,
left="left", right="right", jump="space")
Extends PhysicSprite with keyboard input. Key bindings are fully customisable.
| Method | Description |
|---|---|
player.tick() |
Process input — call this in your game logic function |
player.handle_input() |
Handles left, right, and jump keys |
Animation — Animator (advanced)
from pygames.advanced import Animation
anim = Animator(target, animation_speed=0.1)
Works with objects that have a .state string and an .animations dict mapping state names to lists of Surface frames.
| Method | Description |
|---|---|
anim.refresh() |
Advance animation frame — call every game loop tick |
anim.hover(amplitude=5, speed=5) |
Vertical sine-wave floating motion |
anim.rotate_loop(speed=100) |
Continuous rotation |
anim.set_speed(speed) |
Change frame interval |
Supported Keys
Pass any of these strings to game.check_key_pressed() or as custom key bindings:
"left", "right", "up", "down", "space", "esc", "enter", "shift", "ctrl", "tab", "backspace", or any letter/number like "a", "w", "1"
Native Pygame
Since PyGame-S uses from pygame import * internally, all Pygame features are available directly:
from pygames.advanced import *
mixer.music.load("background.mp3")
mixer.music.play(-1)
draw.rect(game.screen, "red", (100, 100, 50, 50))
Error Handling
| Error | Cause |
|---|---|
FileNotFoundError |
Invalid file path for image, sound, or icon |
TypeError |
Wrong type passed to width, height, speed, or jump force |
ValueError |
Negative speed value |
NameError |
Invalid colour name or missing sound |
Version
Current release: v2.1.1
Inspired by Pygame Zero, built to be more Pythonic, flexible, and extensible.
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygames_simplified-2.1.1.tar.gz.
File metadata
- Download URL: pygames_simplified-2.1.1.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f8f266b17bbf17809aba868d29ae5961c1f8a9a4fb90a5034f48e5d6d4888dd
|
|
| MD5 |
5157a3fa69ce692525429c52dc0e412e
|
|
| BLAKE2b-256 |
68fa89aa9f3f1a0268bbd5d720d64c4fe0dbaccb1d48da9f93d99a2fb1847a03
|
File details
Details for the file pygames_simplified-2.1.1-py3-none-any.whl.
File metadata
- Download URL: pygames_simplified-2.1.1-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4ba66cf16d9846df1d18484324101a3d4a64974e6a0d6d87d18668d661934f0
|
|
| MD5 |
cbe6698bb56a876a2f96f084f93bf667
|
|
| BLAKE2b-256 |
f99017ca14d2e776c29b3211b8f917c6bc4a1580db2c8844a666cfa989695543
|