A 2D Python GameEngine Made With PySDL2
Project description
MandawEngine
A 2D Python GameEngine Made With PySDL2
Discord: https://discord.gg/MPPqj9PNt3
Installation
To install: Type in CMD or Terminal:
pip install mandaw
Or to download the latest version from github Type in CMD or Terminal:
pip install https://github.com/mandaw2014/mandawenginesdl/archive/master.zip
Creating A Window
First, import mandaw
from mandaw import *
Call Mandaw
mandaw = Mandaw(title = "Mandaw", width = 800, height = 600)
To run it, type
while True:
mandaw.run()
Creating A Square
Here is what we have so far
from mandaw import *
mandaw = Mandaw(title = "Mandaw", width = 800, height = 600)
while True:
mandaw.run()
To create a square, type
square = GameObject(window = mandaw, width = 20, height = 20, color = Color(255, 0, 0))
Then draw it
while True:
square.draw()
...
Like this
from mandaw import *
mandaw = Mandaw(title = "Mandaw", width = 800, height = 600)
square = GameObject(mandaw, width = 20, height = 20, color = Color(255, 0, 0))
while True:
square.draw()
mandaw.run()
Classes in MandawEngineSDL
Our starting template
from mandaw import *
mandaw = Mandaw("Classes!", 800, 600)
while True:
mandaw.run()
To make a GameObject class in MandawEngineSDL do:
class Cube(GameObject):
def __init__(self):
Next, make the super().__init__()
super().__init__(
window = mandaw,
width = 20,
height = 20,
x = 0,
y = 0,
color = Color(0, 255, 255)
)
In the __init__
funtion, you can also include self.center()
or any other variables
self.center()
When you want to call the class, you do
cube = Cube()
And don't forget to draw it
while True:
cube.draw()
Full Code:
from mandaw import *
mandaw = Mandaw("Classes!", 800, 600)
class Cube(GameObject):
def __init__(self):
super().__init__(
window = mandaw,
width = 20,
height = 20,
x = 0,
y = 0,
color = Color(0, 255, 255)
)
self.center()
cube = Cube()
while True:
cube.draw()
mandaw.run()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mandaw-2.0.3.tar.gz
(4.6 kB
view hashes)
Built Distribution
mandaw-2.0.3-py3-none-any.whl
(5.4 kB
view hashes)