I've made dozens of platformers in Flash. We had to write all of our own code for collisions back in those days and there was a lot of demand for moving platforms and crates.
Moving platforms are hard. It has to move itself and anything on it.
Crates are even harder. It's like a moving platform, but you can push it and the moving platform can carry it too.
Push Me Pull You
A push can become a branching path with many things responding to one request for movement. This engine handles only one knobbly branch at a time. If the collision doesn't have too many parts, it will get it right.
I made this engine using an object pattern so I could figure out how the hell to make it. Hopefully it's readable and if you hate objects that much then please optimize it and post your results. I'm more than happy to see this engine updated.
The more contact points involved in a collision, the more code it takes to solve. The engine pushes the first thing it sees, it doesn't think about the consequences of a pyramid of crates stacked on your head with odd gaps and a random bit of wall in the middle. I once wrote a loop-solver that handles this but it was some heavy duty stuff, not Pico 8 material. Or prove me wrong, I'd be happy to see an engine that handles it without going full Box2D.
[Please log in to post a comment]