Skip to main content

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(mandaw.world, 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.world, 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, you have to include 'world' in the __init__ function

class Cube(GameObject):
    def __init__(self, world):

Next, make the super().__init__()

super().__init__(
    world = world,
    width = 20,
    height = 20,
    x = 0,
    y = 0,
    color = Color(0, 255, 255)
)

In the __init__ funtion, you can also include

self.center()

When you want to call the class, you do

cube = Cube(mandaw.world)

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, world):
        super().__init__(
            world = world,
            width = 20,
            height = 20,
            x = 0,
            y = 0,
            color = Color(0, 255, 255)
        )

        self.center()

cube = Cube(mandaw.world)

while True:
    cube.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-2.0.2.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

mandaw-2.0.2-py3-none-any.whl (5.4 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