Objectives

Until today, the only way to finish a level was to kill all of the enemies in it. Of course, with our new infinitely enemy-spewing doorway thingys, there would have to be another way. I set up an objectives system that allows us to define any number of different conditions for beating a level.

In the process of testing out the “get a particular item” condition, I became stuck inside a rock. This has been going on since I put together the obstacle collision, and I decided to attack the problem. It turned out to be more difficult than I’d expected. At one point I had a crazy system that checked how many character pixels were overlapping with the obstacle, and compared it to how many would be overlapping were the character allowed to continue on her current course:

overlap.png

In the end, I just did a simple series of four checks (which I originally deemed too tedious) to analyze the x and y components of the character’s velocity, and stopped either one if following it would result in a collision. This lets you slide along an obstacle if at least one of your axes of motion is still valid.

slide.png