Skip to main content

A simple Python 2D game library for building games easily

Project description

# Easy2D


Easy2D is a lightweight 2D engine wrapper built on top of pygame.
It gives you a clean scene/object architecture, timing helpers, camera controls,
tilemaps, and particles so building a game is faster and cleaner.

## Install

```bash
pip install easy2d
```

## Quick Start

```python
import pygame
import easy2d as e

class Player(e.Rect):
def __init__(self):
super().__init__(150, 150, 32, 32, color=(70, 230, 170), gravity=0.0, floor_y=None)
self.speed = 240

def update(self, game):
dx = dy = 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)

scene = e.Scene()
player = scene.add(Player())

game = e.Game("My Easy2D Game", 960, 540)
game.set_scene(scene)
game.run()
```

## Core Concepts

- Game loop with delta-time (`game.delta_time`) and FPS tracking.
- Input helpers (`key_pressed`, `key_just_pressed`, mouse helpers).
- Scene lifecycle (`on_enter`, `on_exit`) and event forwarding.
- GameObject lifecycle (`on_added`, `on_removed`, `destroy`).
- Camera utilities (`follow`, `world_to_screen`, `screen_to_world`).
- Built-in `Rect`, `ParticleSystem`, and `TileMap`.

## Built-in Objects

- `Rect`: Basic drawable rectangle with optional gravity and simple collision helpers.
- `ParticleSystem`: Configurable particles with speed/life/size/gravity ranges.
- `TileMap`: Color tile grid with fast visible-tile drawing and palette loading.

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.2.1.tar.gz (7.1 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.2.1-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for easy2d-0.2.1.tar.gz
Algorithm Hash digest
SHA256 104fcf1bfca9d0da4e15ecac44c7b0b7b4a54085fab202f3236c77ccb92e6116
MD5 2eb9d5342c67b4bf5e3e53f2c3246430
BLAKE2b-256 1c171209e6e045814d432447e7d990d77b768fd0fd6488d97f82b6b3a588d2aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easy2d-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.9 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e98aed5636af047ff22fa0649e21a5cf0869afd9002daa80688bdec1fd11d914
MD5 445da9f16477067f73cc4d78a7de9dea
BLAKE2b-256 c9e252006455904f94e548c0b6b8cf278e48f4e52c3e59d769a4a6045ac4bc7a

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