Skip to main content

A 2D GameEngine Made In Python With PySDL2

Project description

MandawEngine

A 2D Python GameEngine Made With PySDL2

Discord: https://discord.gg/MPPqj9PNt3

Installation

To install: Download the zip: Code->Download Zip Extract it Go into the extracted folder and Type in CMD or Terminal:

pip install setup.py

Creating A Window

First, import mandaw

from mandaw import *

Call Mandaw

mandaw = Mandaw(title = "Window!", width = 800, height = 600, bg_color = (0, 0, 0, 255))

To run it, type

mandaw.loop()

Creating A Square

Here is what we have so far

from mandaw import *

mandaw = Mandaw(title = "Window!", width = 800, height = 600, bg_color = (0, 0, 0, 255))

mandaw.loop()

To create a square, type

square = Entity(window = mandaw, width = 20, height = 20, x = 0, y = 0, color = (255, 255, 255, 255))

Center it with

square.center()

Then draw it

@mandaw.draw
def draw():
    square.draw()

Like this

from mandaw import *

mandaw = Mandaw(title = "Window!", width = 800, height = 600, bg_color = (0, 0, 0, 255))

square = Entity(window = mandaw, width = 20, height = 20, x = 0, y = 0, color = (255, 255, 255, 255))
square.center()

@mandaw.draw
def draw():
    square.draw()

mandaw.loop()

Basic Input In MandawEngine

What we have so far

from mandaw import *

mandaw = Mandaw(title = "Input!", width = 800, height = 600, bg_color = (0, 0, 0, 255))

square = Entity(window = mandaw, width = 100, height = 100)
square.center()

@mandaw.draw
def draw():
    square.draw()

mandaw.loop()

To Move the square, we can use the built in update function along with mandaw.input

@mandaw.update
def update(dt):
    if mandaw.input.pressed[mandaw.input.keys["W"]]:
        square.y -= 100 * dt
    if mandaw.input.pressed[mandaw.input.keys["A"]]:
        square.x -= 100 * dt
    if mandaw.input.pressed[mandaw.input.keys["S"]]:
        square.y += 100 * dt
    if mandaw.input.pressed[mandaw.input.keys["D"]]:
        square.x += 100 * dt

dt here, represents deltaTime

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.3.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mandaw-2.3.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file mandaw-2.3.0.tar.gz.

File metadata

  • Download URL: mandaw-2.3.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

File hashes

Hashes for mandaw-2.3.0.tar.gz
Algorithm Hash digest
SHA256 a399e4f0e49171f32df3bccc80eb9d9b9d27772449d1628644e7988eccfac471
MD5 4cff304a8c8f4e14cf90249f2375af62
BLAKE2b-256 91e674d8ae5ed9a07b681e993f99dab8a1d5f2df5bce2ea74302a551dab12d35

See more details on using hashes here.

File details

Details for the file mandaw-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: mandaw-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

File hashes

Hashes for mandaw-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0638e310a129e38ff262702e190ead17b99dff8a1029b9e24c902afd92ea32de
MD5 27fe7242b2e63ffbd86dc6740fe32c14
BLAKE2b-256 ff946177100347620e924014a64c2fcca57b14528dd5137213ccf2208fa4e9fe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page