Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Death Comes for us All

And what's an action game without death! So I've added pits and spikes to kill the player. And along with that comes a game over screen, and a proper flow in and out of the game back to the title screen, and back to gameplay again.

Clipping Sprites

You may have noticed in that last gif the strip of black tiles down the left side of the screen. This is a little trick of the NES to help with sprites "wrapping around" to the other side of the screen. 

Take a look at this old clip of the game. Notice how when the player walks into the left side of the screen, you can actually see their hand and foot popping out the right side of the screen.

The reason is a little technical but basically you can image the the sprite rendering loops at the edges, so when you try to draw a pixel off screen, it actually shows up on the opposite side of the screen. This happens in all directions, but is more pronounced in horizontal plane.

One way to fix this, and something that I have decided to do, is to use the hardware trick mentioned earlier to turn off the left 8 pixels of the screen. This gives me a little buffer to hide sprites in before the wrap around. The downside is that I lose 8 pixels of screen width, and it looks a little weird on a non-CRT (it's hidden beneath the bezel on most CRTs).

For the top and bottom, there is a similar issue. However, in the vertical plane there is already a 16 pixel buffer built into the rendering, so for that case I simply detect if the object is offscreen more than 16 pixels and if they are, I hide the whole meta-sprite. Ideally I would do this on an 8x8 sprite basis, rather than the entire object, but for my use cases, it works fine as is.

Here's the results:

What's Next?

I think next I'll work on pass-through floors (jump up through, but can walk on) and maybe breakable floors. The breakable case is interesting because currently all level data lives in ROM (Read Only Memory), and breakable floors would imply that the level changes (Writable), so I'll need to figure out something there.