Skip to main content

A practical 2D game framework for Python with scenes, camera, particles, and chunked tilemaps

Project description

Easy2D

Easy2D is a practical 2D game framework on top of pygame with a clean scene loop, camera system, and performant tilemap rendering for larger worlds.

Why Easy2D

  • Fast setup for playable prototypes in minutes
  • Scene and object lifecycle that stays organized as projects grow
  • Delta-time movement and simple input helpers out of the box
  • Chunk-cached tilemap rendering for smoother large maps
  • Simple API that can scale from arcade games to block-world builders

Install

pip install easy2d

Quick Start

import pygame
import easy2d as e

class Player(e.Rect):
    def __init__(self):
        super().__init__(100, 100, 28, 28, color=(80, 220, 180), gravity=0.0, floor_y=None)
        self.speed = 240

    def update(self, game):
        dx = dy = 0.0
        if game.key_pressed(pygame.K_a):
            dx -= self.speed * game.delta_time
        if game.key_pressed(pygame.K_d):
            dx += self.speed * game.delta_time
        if game.key_pressed(pygame.K_w):
            dy -= self.speed * game.delta_time
        if game.key_pressed(pygame.K_s):
            dy += self.speed * game.delta_time
        self.move(dx, dy)

class MainScene(e.Scene):
    def __init__(self):
        super().__init__()
        self.player = self.add(Player())

    def update(self, game):
        super().update(game)
        game.camera.follow(self.player, lerp=0.12)

game = e.Game("Easy2D", 960, 540)
game.set_scene(MainScene())
game.run()

Core API

Game

  • Main loop, screen, timing, and input state
  • delta_time, elapsed_time, fps
  • Input helpers: key_pressed, key_just_pressed, mouse helpers

Scene

  • Object container with safe add/remove during updates
  • Hooks: on_enter, on_exit, handle_event
  • Query helpers: find_by_name, find_by_tag, find

GameObject

  • Base entity with lifecycle hooks and visibility/active flags
  • Properties: x, y, z, active, visible, destroyed

Camera

  • World/screen conversion helpers
  • Smooth follow with optional world bounds

TileMap

  • Sparse tile storage plus chunk-surface caching
  • Visible-chunk rendering for better large-map performance
  • Helpers: set, remove, fill_rect, world_to_tile, tile_to_world, solid flags

ParticleSystem

  • Configurable particle effects with lifespan and gravity

Build Bigger Worlds

Easy2D now supports chunk-cached tile rendering, which is a key building block for games with large tile worlds.

For Minecraft-like workflows, combine:

  • TileMap for block placement and chunk rendering
  • Camera follow and world/screen conversion
  • Mouse world coordinates for place/remove actions
  • Scene queries and object tags for gameplay systems

Current Scope

Easy2D is intentionally lightweight. It does not yet include:

  • Full rigidbody physics and collision resolution
  • Built-in sprite animation pipeline
  • Chunk streaming from disk
  • Networking

These can be layered in while keeping the current API stable.

Package

  • Name: easy2d
  • Python: >=3.8
  • Dependency: pygame>=2.5
  • License: MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easy2d-0.3.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

easy2d-0.3.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file easy2d-0.3.0.tar.gz.

File metadata

  • Download URL: easy2d-0.3.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for easy2d-0.3.0.tar.gz
Algorithm Hash digest
SHA256 283439896e70faafaf49634a539aa0b32e7c2ddf44cb06d7cb1f059af90c10b2
MD5 4536a7c79e659d99e6fc7a9f877b3d18
BLAKE2b-256 37e6500647458115cc24baf4b8f100c0f3372b79bffa6c395356dd6d1b9ae74a

See more details on using hashes here.

File details

Details for the file easy2d-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: easy2d-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for easy2d-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40d9ee0a04fc16b1cb9caf8c761a2db8473498749d96deec2e714198566550b9
MD5 8d3cab30225dfb9ba19d0b574e772bce
BLAKE2b-256 9c12ef384a105ba7e88cbb2311ed630a8e187833d468eea9e8f7d1cb861edc00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page