How we draw the giant enemy spider!

I've seen some commenters point out the giant enemy spider in the room. Let me explain how we draw it!

merge_0.gif

First things first, I'll explain something about the game itself.

Our game is made for the awesome PICO-8 fantasy console! Because of that, we have to do all the everything ourselves, just like on actual retro game consoles.

So, there are two parts to this. First, we need to figure out how the legs move.

The legs have two joints: one at the spider's body and one knee, as such each leg is defined as two lines: from the body to the knee, and from the knee to the tip.

The body is a static point, the knee rotates around a point, and the tip rotates around a point, "left" legs rotating counter-clockwise and "right" legs rotating clockwise. We draw lines between those joints and boom! Leg.

spiderbro_0.gif

Then we need to actually draw the cool stuff.

spiderbro_1.gif

The spider is drawn from outline to fill, with some overdraw on the outline so there aren't any gaps. Since PICO-8 doesn't have a "thick line" builtin, we have to improvise and do the thick lines ourselves.

The fangs, as well as the pattern on it's back, are sprites, and the eye is a pair of circles.

For some PICO-8 specific stuff:

To draw the black outline on a sprite, we use pal(15, 0) to replace color 15 with a non-transparent color 0, giving us a black color that is distinct from the "background" color. You can actually spot it on a few other sprites, as well as a full "non-transparent black" tile. spiderbro_1.png

For the checkerboard pixel fill, a special function exists in PICO-8 for setting a 4x4 fill pattern, using a number in which bits denote which pixel would use primary or secondary color. We use it like this:

lua fillp(0b1010010110100101) -- Let's cut it up to make it more clear. Mind that numbers don't actually work like this! fillp(0b 1010 0101 1010 0101)

For flashing effects, we just pick a color and randomize it with pal(c, 1+flr(rnd(14)))

The game is here, play it! https://ldjam.com/events/ludum-dare/57/spider-cave-offensive