Giter Site home page Giter Site logo

redpenguinyt / gemini-py Goto Github PK

View Code? Open in Web Editor NEW
35.0 3.0 0.0 161 KB

A monospaced 2D ASCII rendering engine for Python

Home Page: https://pypi.org/project/gemini-engine/

License: MIT License

Python 100.00%
game-development game-engine python3 ascii ascii-art ascii-animation game-dev ascii-game python gemini-engine

gemini-py's Introduction

Gemini Engine

PyPI version Stars Last commit Code size Downloads Issues

Gemini Engine is a monospace 2D ASCII rendering engine. It includes collisions, layers, inputs and the ability to handle solid objects as well as ascii art. Examples can be found on the GeminiExamples github

WARNING: It’s important to use a monospace font in the terminal for the engine to render images properly

Quick start

Gemini Engine can be installed using pip:

python3 -m pip install -U gemini-engine

If you want to run the latest version of the code, you can install from github:

python3 -m pip install -U git+https://github.com/redpenguinyt/GeminiEngine.git@latest

Now that you have installed the library, instance a Scene and an Entity, then render the scene

from gemini import Scene, Entity

scene = Scene(size=(20,10))
entity = Entity(pos=(5,5), size=(2,1), parent=scene)

scene.render()

You should get something like this in your console: Gemini example 1

Look at that! You just made your first Gemini project! Now try adding a while loop to the end of your code

from gemini import Scene, Entity, sleep

scene = Scene(size=(20,10))
entity = Entity(pos=(5,5), size=(2,1), parent=scene)

while True:
	entity.move((1,0))
	scene.render()
	sleep(.1)

Now the entity should be moving across the screen! When the entity goes out of the screen's bounds it will loop back round to the other side.

Sprites

The code below will animate a car moving across the screen:

from gemini import Scene, Sprite, sleep

car_image = """
  ______
 /|_||_\`.__
(¶¶¶_¶¶¶¶_¶_\\
=`-(_)--(_)-'
"""

scene = Scene((30,10), is_main_scene=True)
car = Sprite((5,5), car_image)

while True:
	scene.render()
	car.move(1,0)
	sleep(.1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.