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/
Terminal Game Engine
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()