I took the code from the collision shown before and tried to add colors. Adding the colors was not very difficult, however giving specfic tiles a different palette took a bit of research.
I found out the GameBoy color has extra VRAM where attributes can be set per tiles. These attributes include mirroring over X and/or Y, palette and priority over sprites.
Once I found how to write to this VRAM, it was easy to write the right values for the tiles. This is the result. Keep in mind that there are still only 8 palettes, and each palette can use
4 colors. So, every tile still only uses 4 colors. You can see that also the sprite is colored. There are an additional 8 palettes set aside for sprites.
Technical Details
- GameBoy Color
- Background Color Map