As you know by making the sprite mask different colours you can do some interesting effects with sprites in Keen (Such as sprites that look like shadows or change colour depending on their background.)
However while looking at the Keen 1 code I found that there was no way for the program to handle colour masks. Subsequent investigation shows that the program does masks in black or white.
Is this just a problem with modkeen, or the program? Is there any way around this?
Masked sprites
re: color masks
You're probably thinking of SNES-style color masks... where if a sprite passes under, say, a green color mask, the white tints to a bright green, the red tints to a brown, the blue becomes a sort of turquose/teal, and so on. Not possible with our Keen:Vorticons engine. Why? Because we're working with the EGA palette--16 colors! You can't do an RGB style addition and subtraction of the palette when you've only got 16 colors!
The best you can do is some trial and error with different colors as masking tiles and come up with an effect that you think looks good. Full on SNES-style masking would require a 256+ color engine.
--Xky
The best you can do is some trial and error with different colors as masking tiles and come up with an effect that you think looks good. Full on SNES-style masking would require a 256+ color engine.
--Xky
No I'm NOT talking about masked TILES (although they have neat effects)
Just as the mods use coloured tile masks for neat effects, (The origionals used only black and white.) sprites in Keen2-3 can be given colour masks. The sprites colour then depends on what background it is shown against.
As an example make the vorticons mask in Keen 2\3 dark red and see what happens. I want the same effect in Keen 1
Just as the mods use coloured tile masks for neat effects, (The origionals used only black and white.) sprites in Keen2-3 can be given colour masks. The sprites colour then depends on what background it is shown against.
As an example make the vorticons mask in Keen 2\3 dark red and see what happens. I want the same effect in Keen 1
re: Masked Sprites
Sorry for the misunderstanding--and also sorry that I can't help with this at all. Thanks for clearing me up quickly though. ;-)
--Xky
--Xky
- adurdin
- Site Founder
- Posts: 549
- Joined: Fri Aug 29, 2003 11:27 pm
- Location: Edinburgh, Scotland
- Contact:
All the Keen games use a 1-bit mask to indicate transparency or opacity for sprites: so the mask can actually only be "black" or "white".
Modkeen looks for black in the mask to indicate opaque pixels; anything else ends up transparent. So your sprite with the mask filled with dark red ends up just as if you'd filled the mask with any other colour (excluding black), or made the whole mask white. Try it, you'll see.
The reason you get semi-transparent effects when the mask indicates transparency is due to the compositing that the Keen engine does when drawing the sprites. In essence, it does a bitwise AND of the mask with the screen (which essentially keeps the darkest colours of each--keeping in mind that the mask is only black or white), and then a bitwise OR of the sprite image (which essentially keeps the brightest colours).
Modkeen looks for black in the mask to indicate opaque pixels; anything else ends up transparent. So your sprite with the mask filled with dark red ends up just as if you'd filled the mask with any other colour (excluding black), or made the whole mask white. Try it, you'll see.
The reason you get semi-transparent effects when the mask indicates transparency is due to the compositing that the Keen engine does when drawing the sprites. In essence, it does a bitwise AND of the mask with the screen (which essentially keeps the darkest colours of each--keeping in mind that the mask is only black or white), and then a bitwise OR of the sprite image (which essentially keeps the brightest colours).