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:
- Download the zip
- Extract the zip
- 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()