https://github.com/mandaw2014/mandawengine
A Game Engine Made in Python with the Pygame Module
https://github.com/mandaw2014/mandawengine
2d gameengine mandaw mandawengine pygame python
Last synced: 25 days ago
JSON representation
A Game Engine Made in Python with the Pygame Module
- Host: GitHub
- URL: https://github.com/mandaw2014/mandawengine
- Owner: mandaw2014
- License: mit
- Created: 2021-08-15T15:22:08.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-03T20:46:02.000Z (almost 4 years ago)
- Last Synced: 2025-07-30T22:31:46.831Z (9 months ago)
- Topics: 2d, gameengine, mandaw, mandawengine, pygame, python
- Language: Python
- Homepage: https://mandaw2014.github.io/MandawEngine/
- Size: 704 KB
- Stars: 18
- Watchers: 4
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MandawEngine
A Game Engine Made in Python with the Pygame Module
Discord: https://discord.gg/MPPqj9PNt3
# Installation
To Get The Latest Version of MandawEngine:
On Windows:
```
pip install https://github.com/mandaw2014/mandawengine/archive/master.zip
```
On Mac and Linux
```
pip3 install https://github.com/mandaw2014/mandawengine/archive/master.zip
```
# Getting Started
import Mandaw
```py
from mandaw import *
```
Make a window
```py
from mandaw import *
mandaw = Mandaw()
mandaw.loop()
```
Make a simple square
```py
square = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "red", width = 20, height = 20)
```
Center it with
```py
square.center()
```
Draw it
```py
@mandaw.draw
def draw():
square.draw()
```
# Full Code
```py
from mandaw import *
mandaw = Mandaw("First Mandaw Window!")
square = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "red", width = 20, height = 20)
square.center()
@mandaw.draw
def draw():
square.draw()
mandaw.loop()
```
# Collisions Between GameObjects
What we have so far
```py
from mandaw import *
mandaw = Mandaw("Collisions!", bg_color = "cyan")
square = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "orange", width = 20, height = 30)
square.center()
ground = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "gray", width = 5000, height = 100)
ground.center()
ground.y = 500
@mandaw.draw
def draw():
square.draw()
ground.draw()
mandaw.loop()
```
Here We Can Use The `collide()` Function along with the built in `update()` function. For example, We're Going To Make Gravity Here
```py
from mandaw import *
mandaw = Mandaw("Collisions!", bg_color = "cyan")
square = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "orange", width = 20, height = 30)
square.center()
ground = GameObject(window = mandaw, shape = "rect", x = 0, y = 0, color = "gray", width = 5000, height = 100)
ground.center()
ground.y = 500
@mandaw.draw
def draw():
square.draw()
ground.draw()
@mandaw.update
def update(dt):
# Collision code here
if not square.collide(ground):
# Square's y position += 1 x deltaTime
square.y += 1 * dt
mandaw.loop()
```
# Platformer Controller Prefab
What we have so far
```py
from mandaw import *
mandaw = Mandaw("Platformer Example", bg_color = "cyan")
mandaw.loop()
```
Import the PlatformerController2D with
```py
from mandaw.prefabs.platformer_controller import PlatformerController2D
```
Then call it
```py
player = PlatformerController2D(mandaw, x = 0, y = 0, centered = True)
```
Then in the ```def update(dt)``` function, call
```py
@mandaw.update
def update(dt)
player.movement(dt)
```