Skip to main content

A Game Engine Made In Python

Project description

MandawEngine

A Game Engine Made in Python with the Pygame Module

Discord: https://discord.gg/MPPqj9PNt3

Installation

To Install, type

pip install mandaw

To Get The Latest Version of MandawEngine:

  1. Download the zip
  2. Extract the zip
  3. Navigate to the folder in cmd or terminal and type:

On Windows:

python setup.py install

On Mac and Linux

python3 setup.py install

Getting Started

import Mandaw

from mandaw import *

Make a window

from mandaw import *

mandaw = Mandaw() 

while True:
    mandaw.run()

Make a simple square

square = GameObject(mandaw, "rect", x = 0, y = 0, color = "red", width = 20, height = 20)

Center it with

square.center()

Draw it

while True:
    square.draw()

Full Code

from mandaw import *

mandaw = Mandaw("First Mandaw Game")

square = GameObject(mandaw, "rect", x = 0, y = 0, color = "red", width = 20, height = 20)
square.center()

while True:
    square.draw()
    mandaw.run()

Collisions Between GameObjects

What we have so far

from mandaw import *

mandaw = Mandaw("Collisions!", bg_color = "cyan")

square = GameObject(mandaw, "rect", x = 0, y = 0, color = "orange", width = 20, height = 30)
square.center()

ground = GameObject(mandaw, "rect", x = 0, y = 0, color = "gray", width = 5000, height = 100)
ground.center()
ground.y = 500

while True:
    square.draw()
    ground.draw()   

    mandaw.run()

Here We Can Use The collide() Function. For example, We're Going To Make Gravity Here

from mandaw import *

mandaw = Mandaw("Collisions!", bg_color = "cyan")

square = GameObject(mandaw, "rect", x = 0, y = 0, color = "orange", width = 20, height = 30)
square.center()

ground = GameObject(mandaw, "rect", x = 0, y = 0, color = "gray", width = 5000, height = 100)
ground.center()
ground.y = 500

while True:
    # Collision code here
    if not square.collide(ground):
        # Square's y position -= 150 x deltaTime
        square.y += 150 * mandaw.dt 

    square.draw()
    ground.draw()   

    mandaw.run()

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

mandaw-1.0.9.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

mandaw-1.0.9-py3-none-any.whl (7.9 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