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.0.tar.gz (2.3 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.0-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: easy2d-0.2.0.tar.gz
  • Upload date:
  • Size: 2.3 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.0.tar.gz
Algorithm Hash digest
SHA256 25837229fab31c57f85d5d43fc90435d02ee58bd4769c7f81e339359eeb3189a
MD5 e9434902ea4cc1ec1b25c36d27b36889
BLAKE2b-256 3a5a2c4dba433252dc0f69f77975798abaa18d3e037fe08e9e18f86a050f6cd2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: easy2d-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 2.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74543a1a1990d346ffaacf0327145cbf647b27d0ec9e09448f07eb432da91106
MD5 305e3a37931da5d2af3c01021ff33c70
BLAKE2b-256 e8129b1590392a31f5836f62e82226d618488f337431ea8c2ae65353c7b962fe

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