Platformer progress

After a long break I've started working on the platformer engine again. I've added a material system, where every level shape (i.e. polygon) has a material assigned to them, which defines the texture and physical properties (friction, restitution and density) for the shape. Later on this could be used to trigger different sounds or other effects based on where the player walks, for example.

I improved the lighting system to support rotating lights and finally enabled them to be placed to the level in Inkscape (the lights were previously completely randomly generated). To test these new features, I abandoned the ugly mess of a test map I had been using from the start, and built my first "real" level. It's not too detailed yet (and yes, ugly in some points too!) but at least it's better than some random polygons. I do plan to expand it to test new features as they get implemented. Check out these screenshots to see the brand new level in action. 🙂 Disclaimer: All the textures etc. and even the whole style are temporary and not representative of the final game (if I manage to complete it some day), purely because I have not decided on the final style yet! I may opt for more stylished visuals, as in not using "realistic" (photograph based) textures, contrary to what you see in these images. But as I said, I'm not sure yet.

Speaking of new features, I added support for "floor shapes" – shapes that act as a floor but not as a ceiling. That means you can stand on them but jump through them only from below. You can also drop down when needed. These things are so common in platformers, so I had to have them in. Unfortunately I had to restrict them to be straight horizontal lines – "floor lines" like I call them in the code – due to technical difficulties with the Box2D physics. At first I tried doing this with Box2D sensors/contact listener but it seemed like a bad hack and would probably have not worked correctly in some cases, so I deemed it too much trouble and went for a simpler approach. My biggest gripe with Box2D is actually the contact listener, it's somewhat hard to use it nicely..

One of the things I'll start coding next is sprites, which will be used in several places: as normal level decoration, level decals, in the background and so forth. Currently everything you see is crafted from polygons, which is wasteful on the resources. In the current test level, at least the mailbox, arrow sign and mushrooms should be sprites.

That is all this time (got to run to the school soon.. 😐), stay tuned for more! 😉