Yummy Sprite Pastries

I am currently making comparably good progress with the game engine and the editor. One notable thing that I added was the mechanism to allow fore- and background graphics. It is based on sprites and is making use of the “Cookie Cutter” effect: Sprites can have a lower priority than the normal graphic on the screen. At the same time, a sprite can have a higher priority than the player sprite. The player sprite again has a higher priority than the normal character graphic, as it is supposed to be displayed over the background graphics. This obviously creates a strange situation, where the player is configured to be displayed over the character graphic, the other sprite is displayed over the player sprite, and the character graphic is displayed over the other sprite. The video chip of the C64 solves this dilemma by displaying the character graphic over the player wherever the other sprite is non-transparent. A little bit like a cookie cutter will cut out parts of the dough. Sounds complicated? It is, but it can be used to create effects like the one below, where parts of the character graphic is displayed in the foreground, and other parts are in the background.  It needs some dynamic handling of the sprites, because the bridge in the video is clearly too wide to be covered by the available 6 sprites. So the sprites are only enabled when there is an overlap between them and the player. Apologies for the music, I always have some arbitrary SID blaring so that I can check if the available raster time is ok.