Recommended Posts

okay so I have just started on learning more about java game development. I’m using the slick library And I have read that it’s preferred to use png files but when I’m looking around the world wide wep I’m finde every thing but png files and if I find png fiels they look like the attached files explosion_2.png with in my head makes no sense to display in a game unless you can get those explosion running like a animation some how???

Am I missing some thing?

I’m also finding a loot off bmp file with is looking like base.bmp attached file how can I use one off those models in my game??
1. Can I use bmp files
2. How due I spilt it up so I only use one off the modules??

Share this post

Link to post

Share on other sites

.BMP is typically not used for much in game development, due to its lack of an alpha channel. .PNG is more useful in that regard.

The image you posted is an example of what they often call a sprite sheet. It is intended to be "split up" (not literally) into frames. A frame can be thought of as a sub-rectangle of the image, which encloses one bit or part of the explosion. If the frames are displayed in sequence, one after another, at a rapid enough rate the illusion of something happening is created. With a sprite such as your explosion above, you will require an alpha channel (or some other method of removing all the pixels that are not part of the explosion), hence the recommendation of using .PNG, .TGA or some other format that supports alpha. The alpha channel is used to allow the background to show through the drawn sprite wherever there is not a pixel that is part of the explosion.

Now, you don't literally split the image up. Instead, in your game you conceptually split it up by mapping each bit or piece (sub-rectangle) to a sprite frame. When a given sprite frame is drawn to the screen, it only draws the particular sub-rectangle associated with that frame. How you accomplish this exactly depends highly upon your graphical API. An animation will typically store some sort of list of frames to display in sequence.