A practical 2D game framework for Python with scenes, camera, particles, multiplayer networking, CLI host/join tools, chunked tilemaps, and an in-house UI/backend
Project description
Easy2D
Easy2D is a general-purpose 2D game framework for Python with an in-house backend API. It is designed to support many kinds of 2D games: arcade, platformer, top-down, RPG-style, puzzle, shooter, story-driven, menu-heavy, multiplayer prototypes, and experimental projects.
Install
pip install easy2d
Quick Start
import easy2d as e
game = e.Game("My Game", 960, 540, fps=120)
class MainScene(e.Scene):
def __init__(self):
super().__init__()
self.player = self.add(e.Rect(100, 100, 32, 32, gravity=0.0, floor_y=None))
self.title = self.add(e.Text("Hello Easy2D", 20, 20))
self.button = self.add(e.Button("Play", 100, 100, 180, 50, on_click=self.play))
def play(self):
print("Play clicked")
game.set_scene(MainScene())
game.run()
Display and Fullscreen
game = e.Game(
"Display Demo",
960,
540,
fullscreen=False,
resizable=True,
vsync=True,
scale_mode="fit", # native | fit | stretch | pixel-perfect
)
game.toggle_fullscreen()
game.set_resolution(1280, 720)
UI
scene.add(e.Text("Settings", 30, 20, size=30))
scene.add(e.Panel(20, 50, 420, 260))
scene.add(e.Button("Apply", 40, 80, 170, 44, on_click=apply_settings))
scene.add(e.TextInput(40, 140, 240, 40, placeholder="Player name"))
scene.add(e.Checkbox(40, 200, text="Fullscreen"))
scene.add(e.Slider(40, 250, 220, min_value=0, max_value=100, value=75))
Sprites and Animation
player = e.Sprite("assets/player.png", 100, 100)
player.scale = 2
player.flip_x = True
player.rotation = 8
anim = e.AnimatedSprite(200, 100)
anim.add_animation("idle", ["idle1.png", "idle2.png"], fps=6)
anim.add_animation("run", ["run1.png", "run2.png"], fps=12)
anim.play("run")
Audio and Assets
game.assets.load_image("player", "assets/player.png")
game.assets.load_json("level", "assets/level1.json")
game.assets.load_font("main", size=24)
game.audio.load_sound("coin", "assets/coin.wav")
game.audio.play_sound("coin")
game.audio.play_music("assets/theme.mp3", loop=True)
Particles
fx = e.ParticleSystem.explosion()
fx.emit_burst(200, 200, count=40)
Networking Helpers
server = e.MultiplayerServer(port=5000)
server.start()
server.broadcast({"type": "chat", "text": "hello"})
messages = server.get_messages()
client = e.MultiplayerClient()
client.connect("127.0.0.1", 5000)
client.send({"type": "hello"})
inbox = client.get_messages()
client.disconnect()
CLI
easy2d --help
easy2d --show-scope
easy2d --multiplayer
easy2d --multiplayer --port 7777
easy2d --host --port 5000
easy2d --join 127.0.0.1 --port 5000 --message "hello"
easy2d --net-test --port 5000
easy2d --list-examples
easy2d --write-example basic
easy2d --write-example ui
easy2d --write-example particles
easy2d --write-example multiplayer
easy2d --write-all-examples
easy2d new arcade MyGame
easy2d new topdown MyTopDown
easy2d new shooter MyShooter
Current Scope
- Scene-based game loop
- Camera follow/zoom/shake
- Tilemaps with chunk caching
- UI widgets
- Sprite and basic animation classes
- Particle systems
- Audio and asset managers
- Timer and tween helpers
- Beginner-friendly multiplayer relay helpers
Roadmap
- Expanded physics and collision response
- Sprite atlas/animation tools
- Save/load helper utilities
- Optional higher-level networking patterns
- Additional UI widgets and layout helpers
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 easy2d-0.5.1.tar.gz.
File metadata
- Download URL: easy2d-0.5.1.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbf83ba7ee5f2b9bed1e06ed5100a7f67b9ff428c7f0d87a56bfc4cead220ad9
|
|
| MD5 |
af7c1942cb814f58182be8ca40aaebff
|
|
| BLAKE2b-256 |
dde3c83a857da18d70236b2091fd6193a51f7eb1e7689bebf23f7816301faac2
|
File details
Details for the file easy2d-0.5.1-py3-none-any.whl.
File metadata
- Download URL: easy2d-0.5.1-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddc04f29ffe46277311fb5b003ccd02d697f6327c6094a0438521789223f550e
|
|
| MD5 |
dc7660f47b578effc63a29cde5e601f4
|
|
| BLAKE2b-256 |
5e6edb99d30f73a7fe4dd471dd1936c4abe07b5969321cabd0c05da740cb39c3
|