pygame-topdownengine is a 2.5D engine for top-down games.
Project description
pygame-topdownengine
pygame-topdownengine is a 2.5D engine for top-down games. It is designed to be highly modular, with most core systems being located in the easily extendible GameObject class. It is built on top of the pygame-ce package, which you can find here: https://github.com/pygame-community/pygame-ce/tree/main.
Features
GameObjectclass that contains all of the core systems.MobileObjectclass that allows for modular movement behavior.EnvObjectclass for environmental decorations or objects.- Built in
VisualUtilsclass that allows for the easy manipulation of Surfaces. - Option to use either pixel-perfect or subpixel rendering.
- Dynamic scale-setting for all
GameObjectinstances. - Robust 3D collision detection.
- Toggleable
Game.debugattribute to render hitboxes during development.
Quickstart
This code makes a Player character, a secondary character that will attempt to follow the Player character, and a solid object the Player can collide with and jump over.
import topdownengine as tde
from topdownengine.mobile_object.controller import KeyboardInputController, MovementAIController
from topdownengine.asset_paths import ASSETS_DIR
import pygame as pg
# Define an instance of the Game class
game = tde.Game(
screen_width=900,
screen_height=650,
window_title="pygame-topdownengine Basic Usage Example"
)
# Define a MobileObject to be the Player
player = tde.MobileObject(
controller=KeyboardInputController(),
animation_paths={
'idle': ASSETS_DIR / 'example-player' / 'idle.png',
'walk': ASSETS_DIR / 'example-player' / 'walk.png'
}, frame_size=(16, 16), directional_anims=True
)
# Define a MobileObject to follow the Player
enemy = tde.MobileObject(
controller=MovementAIController(target_mobile_object=player),
animation_paths=player.animation_paths, # Use same animations as the Player
frame_size=(16, 16), directional_anims=True
)
# Define an EnvObject
env_obj = tde.EnvObject(frame_size=(32, 32), colliders=[pg.Rect(0, 0, 32, 32)])
env_obj.position = pg.Vector2(100, 100)
env_obj.obj_shadow = '32x16'
# Add them to the game object group
game.game_object_group.add(player, env_obj, enemy)
# Rescale GameObjects to have a SCALE of 3 (this makes them more visible)
tde.GameObject.set_scale(3, game)
# GameObj automatically generates a four frame "flashing animation."
# In order have our EnvObj not flash, we will make it use only the first frame.
env_obj.animations['idle'] = [env_obj.animations['idle'][0]]
# You can add subpixel rendering by uncommenting the below line of code.
# tde.GameObject.SUBPIXEL = True
# Run the game
game.run()
Installation
In order to install pygame-topdownengine, make sure Python and pip are both installed and in PATH. Then, run this command into your terminal:
pip install pygame-topdownengine
License
This library is distributed under the MIT license, which can be found in the root of this repository under the LICENSE file.
The source files located in the examples subfolder are licensed under the Creative Commons Zero 1.0 Universal license, which can be found inside of examples/LICENSE.
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
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 pygame_topdownengine-0.1.0.tar.gz.
File metadata
- Download URL: pygame_topdownengine-0.1.0.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a910d5ed70f7e0a8b9457c0e0e3749ba9721448bf59d08d06423c532e9045e7d
|
|
| MD5 |
225e656ba0860f4506ee2dad28231de6
|
|
| BLAKE2b-256 |
e8085ae3902939102fc77be144540cac0b96e02abe32096982b158eef8fb7edb
|
Provenance
The following attestation bundles were made for pygame_topdownengine-0.1.0.tar.gz:
Publisher:
release.yml on shaurya-sharma-dev/pygame-topdownengine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygame_topdownengine-0.1.0.tar.gz -
Subject digest:
a910d5ed70f7e0a8b9457c0e0e3749ba9721448bf59d08d06423c532e9045e7d - Sigstore transparency entry: 1915093438
- Sigstore integration time:
-
Permalink:
shaurya-sharma-dev/pygame-topdownengine@d5b82773961d7dccda8c9743a419dc2b65ce9583 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shaurya-sharma-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d5b82773961d7dccda8c9743a419dc2b65ce9583 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygame_topdownengine-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pygame_topdownengine-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89e4bf5a9a5f8f368c51f2a53361088f858dcd35a80e31f35ebb9c8abca3c9a3
|
|
| MD5 |
7112d92083aeacf674854d45477147b1
|
|
| BLAKE2b-256 |
d8e60321c2b3e8f5d51efa9d1677aad0147d7d6111fdc83f968566f104071d89
|
Provenance
The following attestation bundles were made for pygame_topdownengine-0.1.0-py3-none-any.whl:
Publisher:
release.yml on shaurya-sharma-dev/pygame-topdownengine
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygame_topdownengine-0.1.0-py3-none-any.whl -
Subject digest:
89e4bf5a9a5f8f368c51f2a53361088f858dcd35a80e31f35ebb9c8abca3c9a3 - Sigstore transparency entry: 1915093658
- Sigstore integration time:
-
Permalink:
shaurya-sharma-dev/pygame-topdownengine@d5b82773961d7dccda8c9743a419dc2b65ce9583 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shaurya-sharma-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d5b82773961d7dccda8c9743a419dc2b65ce9583 -
Trigger Event:
push
-
Statement type: