Citrus Hit Areas
Monday, November 19th, 2007The Citrus Engine uses rectangles to detect all collisions. In certain cases, circles can be involved, but for the most part, every collidable object will be a rectangle.
Initially, this seems like a limitation, and you might think that the end result can only look something like this:

A Citrus Level can be much more complex than this, although there are numerous advantages to structuring levels like this, which is why Nintendo continued to do so all the way up through Super Mario World 2 and even into New Super Mario Bros for the Nintendo DS. In terms of level design, simpler can often be better as it allows players to glide through the level with a certain finesse (if they’re good enough) without getting stuck on inclines and tiny potholes.
Just so we are able to think outside the box, check out this background and notice the red rectangles.

These rectangles would represent the areas that our hero can stand on. In fact, during the level’s development, those rectangles are all we will be able to see, but once a background is applied to it, you can see the complexity and richness that can be added. Of course, there are some level design issues with this layout, as there are many areas where the player can get stuck or frustrated.
The Characters in a Citrus game must also be confined to rectangles. Each character is represented by one rectangle. The rectangle will not appear on the screen, but they will be used to determine when they are touching another object, be it an enemy, powerup, or the ground. Consequently, the characters must generally mimic a rectangle.
Below is an example of what a baddie could look like. Notice that he is not exactly a rectangle shape, but he can be defined by one. Any collisions with his rectangle will appear to be collisions with his Sprite even though they may not exactly collide with his Sprite.

The next image would NOT be good usage of the characters’ rectangular confinements because there is too much negative space in certain areas. Objects that collide with the giraffe’s rectangle probably won’t always appear to have hit him.

More Citrus Concepts to come. Stay tuned!









