Monthly Archives: November 2009

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

mortalGuys

Hi! Tonight I implemented a bunch of stuff to add flexibility to our map objects. When an object is added to the map, it checks a dictionary of dictionaries of dictionaries to find out if it should have any special attributes. One of the possible attributes is an “initStep”, which is the name of a function to call one time when the object is created. This gives us a free pass to do anything we want with a new map object: add it to some special sprite group, give it a weird behavior, and so on.

The initial motivation for this was to be able to create crazy puzzley situations like an enemy spawner which constantly sends dudes across a space toward a hazard that kills them. This creates a sort of doorway of enemies that you have to blast through. Actually the hazard will kill any mortalGuy that comes in contact with it; that includes both enemies and the player…