A 2D Python GameEngine Made With PySDL2
Discord: https://discord.gg/MPPqj9PNt3
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
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()
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()
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