Prefabs

Using The PlatformerController2D Prefab

First, import it


from mandaw.prefabs.platformer_controller import PlatformerController2D

Then call it


player = PlatformerController2D(window = mandaw, x = 0, y = 0, centered = True)

And then in the draw() function, type


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

In the update(dt) function, type


@mandaw.update
def update(dt):
player.movement(dt)


Collisions with other Entities


ground = Entity(mandaw, width = 5000, height = 100, x = 0, y = 500, color = color["lightgray"])

Center it's x


ground.center_x()

Append it to player.objects


player.objects.append(ground)


Draw it


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


You should now be able to move and jump around :)


An example of the PlatformerController2D in use


A modified version of PlatformerController2D that is infinite