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

Fixed/parallax layers #4

Open lordmauve opened 5 years ago

lordmauve commented 5 years ago

Updating the camera position currently affects all layers.

HUD components will need to be independent of camera position.

Similarly, parallax backgrounds would be only fractionally sensitive to the camera position. But could possibly be fixed in one axis.

In general one could have a camera sensitivity matrix for each layer which multiplies the camera's position when drawing the layer.

lordmauve commented 4 years ago

(I am not sure if this can be a matrix. Certainly if the camera can rotate.)

lordmauve commented 4 years ago

Maybe it would be better to just make layers (and camera) Transformable. Then fixed layers could be achieved just by grouping the camera with the layer (but this might not be flawless due to floating point accuracy, as it would involve the inverse of the camera matrix * the layer matrix).

Generically transformable layers would enable parallax but also things like "zooming into a scene" (like this).