Skip to main content

Terminal game engine for Python

Project description

tegen

Documentation Status PyPI version Github Version Python Versions License

GitHub code size in bytes GitHub repo size GitHub last commit GitHub Release Date CodeFactor PyPI - Downloads

Terminal game engine for Python, made by 7d

Latest release version: v0.0 (29/8/21) Changelogs: https://tegen.readthedocs.io/en/latest/changelog.html

Documentation: https://tegen.readthedocs.io/en/latest/

images/tictactoe.gif

Why 'Tegen'?

Terminal Game Engine

Usage

import tegen
from blessed.keyboard import Keystroke

game = tegen.Game()
scene = tegen.Scene()

class GameObj(tegen.objects.Sprite):
    direction = 1

    def on_keyboard_press(self, g: tegen.Game, key: Keystroke):
        if key == "a":
            self.x += 1

class GameText(tegen.objects.Text):
    def on_keyboard_press(self, g: tegen.Game, key: Keystroke):
        self.text += key
        if key == 'q':
            g.end()

scene.add_object(GameObj(), "obj", 0, 0)
scene.add_object(GameText("", back="ffa500"), "key", 0, 4)

try:
    game.start(info_wait=1)
    game.add_keyboard_listener()
    game.load_scene(scene)
except Exception:
    game.handle_error()

Example tictactoe game

Project details


Release history Release notifications | RSS feed

This version

0.0

Download files

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

Source Distribution

tegen-0.0.tar.gz (23.2 kB view hashes)

Uploaded Source

Built Distribution

tegen-0.0-py3-none-any.whl (24.0 kB view hashes)

Uploaded Python 3

Supported by

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