Sign in to follow this  
Breander

Making basic sprites for game

Recommended Posts

Breander    140
I'm trying to create some really simple sprites for my pong game using Photoshop. My problem is how do I convert my file into either .bmp or .pcx but still have the transparency parts of the image well be transparent in the game instead of white. What I've been doing is saving the file as a .gif then saving it as a .bmp or .pcx. That's the only way I could figure out how to get it into either of those 2 formats. I'm very new to photoshop so I'm clueless.

Share this post


Link to post
Share on other sites
SiCrane    11839
Neither the BMP or PCX image formats support transparency. You'll have to choose a different image format if you want non-color key transparency. Consider Targa or PNG.

Share this post


Link to post
Share on other sites
u235    359
Or you could write a loader and have all the white pixels not be displayed. That's what allegro does except for pink pixels instead of white.

-AJ

Share this post


Link to post
Share on other sites
demonkoryu    980
Quote:
Original post by SiCrane
Neither the BMP or PCX image formats support transparency. You'll have to choose a different image format if you want non-color key transparency. Consider Targa or PNG.


That's not entirely true. You use 32 bit RGBA files just fine.

Share this post


Link to post
Share on other sites
Breander    140
Quote:
Original post by u235
Or you could write a loader and have all the white pixels not be displayed. That's what allegro does except for pink pixels instead of white.

-AJ


Allegro is what im using.

Share this post


Link to post
Share on other sites
PaulCesar    524
If your using allegro, check out MaskedBlit (or maskblit, something like that). Presuming you have a bit depth between 15-32, then allegro will use magneta (max red, max blue, 0 green) as the transparent color in the image. Simply load up any image with that color, and it will be transparent when you used the "masked" alternative functions. If you are developing the app in 8 bit mode, the color you need is 0, which is (usualy) black.

EDIT: Last time I checked allegro does not allow you to specify the mask color, but that could have changed. I am positive these are the defaults as the library sudgests.

u235:

The "Loader" that allegro uses does nothing of the sort, its done by a specialized blitter. The specialized blitter skips pixels when the bit is equal to the mask color. You could, for instance, run that same image through the generic blit, and the mask color would be visiable.

Share this post


Link to post
Share on other sites
sadrius    244
As far as I know, with Allegro, there is no function to change the mask color. One must redefine macros in order to set an arbitrary mask color.

When using 8-bit color, the mask color is palette entry #0 by default. This can be changed by redefining MASK_COLOR_8 to another entry (valid values are 0-255). The easiest way to change the mask color in 8-bit depth is to simply change palette entry #0 to your desired mask color (perhaps white, which would be RGB 63, 63, 63 in 8-bit color).

When using any other color depth, the mask color is an RGB triplet defined by MASK_COLOR_#, where # is your color depth, in bits (valid values are 15, 16, 24, and 32). The default RGB value for these color depths is "magic pink," or max red, min green, max blue. As to how these values are actually defined in the aforementioned macros, I have no idea (I don't have the source in front of me).

Regardless, changing these values requires a recompilation of the library. To be honest, I don't think changing the mask color is really worth it. It's been set to magic pink for a reason (as nobody in their right mind uses that color except for masks). If you absolutely must have magic pink in your graphics, then I guess you can always make some source changes and recompile Allegro.

Your problem is that you're trying to store alpha data in a file format that does not support it (hence your transparency in photoshop is appearing as white). I suggest using png or tga, or using magic pink if you want to use the bmp file format.

Hope that helps.

Share this post


Link to post
Share on other sites
Breander    140
So what your saying is that the parts I want to be transparent have to be pink. OK!

Also-
Are there any other programs that are much simpler to use to make sprites?
Photoshop seems like overkill for that.

Share this post


Link to post
Share on other sites
Breander    140
Ok these are the file types I can use in allegro BMP, LBM, PCX, and TGA. I can create the image I want but how do I take it from a .psd file that photoshop makes into one of the formats that I can use. It doesn't give me one of those formats as an option when I use save as.

I have been converting them into jpgs, then I open that file and it lets me convert into one of the formats I can use. But I don't think thats the right way to do it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this