Last Ninja C64 sprite-background overlapping

Depending on the position, the background-sprite overlap algorithm might fail (left) or do just fine (right). Mind you, when it fails it’s just one pixel off along the horizontal direction. This is what I would like to fix next in LN.

Comparison for sprite-graphic overlapping bug in LN

Comparison for sprite-graphic overlapping bug in LN

The way this overlapping stuff works is rather simple from a high level viewpoint. Some locations have graphic elements (wall, pillar, etc) for which sprites have to create the illusion they are behind those elements. The way this is achieved is by blanking out portions of the sprite based on its position within the location, using the element’s bitmap data as a delete-mask. A sprite->graphic coordinate transformation has to take place before a comparison can occur between homogeneous coordinates. Being this an isometric system, there is a depth factor, but that is worked out of the X-Y coordinates of the sprite.

I think the bug is in the bit masking: the delete-mask offsets are valid for a multicolour environment where the “granularity” of pixels is 2 in width. Hence the overlapping will work for a certain position of the sprite, but not if you move it 1 pixel left or right from there.

This entry was posted in Retrocomputing and tagged . Bookmark the permalink.

One Response to Last Ninja C64 sprite-background overlapping

  1. Pingback: More work on the framework | Luigi Di Fraia's e-Footsteps

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s