lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
156 stars 24 forks source link

Actor compatibility shim #7

Closed lordmauve closed 5 years ago

lordmauve commented 5 years ago

In Pygame Zero the Actor class was a sprite combined with a bounding box. This makes it pretty easy to do simple collision detection in a game.

Additionally one could assign arbitrary attributes to an actor which is a simple convenience.

Wasabi2d treats all primitives equivalently so Actors were not copied from Pygame Zero. And the new positioning - with rotation and scaling - means that bounding boxes can change frequently. But this makes it hard to write even basic games like Flappy Bird.

It would be useful to add an Actor compatibility layer that adds an AABB to a primitive and provides a rect-like API.

Later, better collision detection using convex polygons may be the best option.

lordmauve commented 5 years ago

I think this is mostly working now. Bounds don't get updated once the Actor is created but it's good enough for the Flappy Bird and Breakout example games.