Skip to main content
gamedev.net
🔒 Locked

2D Level loading from bitmaps

Started by hoogie 2 replies 450+ views
Original Post
hoogie
hoogie
Hi all, Im currently working on a 2D side scrolling shooter and am looking at how to implement the level loading. I have been told of a technique where you scan a bitmap image file and load different entities dependant on the images colours. I was just wandering how this technique was done? How do you open an image file and scan it pixel by pixel whilst checking the colour? Thanks
lack o comments
lack o comments
For starters, you have to know how to open and read file data. I'll leave that part up to you. You will also need information on the file-format for the type of image you are using. There are plenty of sources on the web. Here's one http://www.wotsit.org/

Basically, you open the file, start reading data and store the important stuff, maybe in an array or something. A lot of the data is just for identifiy the type of file, getting a description of the image (like sizes and bit-depth) and also any compression information.

[edit]Damn! Posted link to wrong site. Damn thing nearly crashed my whole computer![/edit]
[edit] Ok, fixed the link [/edit]
DrunkenHyena
DrunkenHyena
Rather than loading an image and then interpreting pixel colours, why not just create a plain data file that defines what you want where?

Creating an editor might take a little while, but it's a lot better than using a pain program for level design.
Stay Casual,KenDrunken Hyena</FON
roger_hq
roger_hq
I agree. Create your levels in flat text files (at least to start with). Create a level editor while or before you create your game, it makes developing your game much, much simpler. With the last game I developed, I hand-edited the text file for each level, until it just got too cumbersome to remember what each entity code stood for. So then I just bit the bullet and created a level editor and that was a huge time and frustration saver.

Cheers

_____________________________http://www.deepbluefuture.com"Set Phasers to neuter...""2+2=5 for sufficiently large values of 2."

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.