SuperTux / supertux

SuperTux source code
https://supertux.org
GNU General Public License v3.0
2.47k stars 472 forks source link

Scale parallax layers perspectively-correctly #2954

Open Hume2 opened 1 month ago

Hume2 commented 1 month ago

I implemented it for both tilemaps and backgrounds. DEMO: https://www.youtube.com/watch?v=GnFArTYBL4E

Scaling now works so that it imitates a perspective camera. The layers scale differently based on their scrolling speed.

Also note that the z-position based on which the scaling is calculated, does not depend on the "z-pos" value at all, so it is nicely compatible with the old levels.

It also fixes the bug which allows players to see around paralax layers when the viewport is scaled down. If the layer is large enough to cover the level in the default scale, it now works in all scales.