Load a 2d map

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
trisman
Posts: 9
Joined: Sat Jun 11, 2005 5:59 pm

Load a 2d map

Post by trisman »

Hi ,
I'm still playing around with the engine, and i was wondering...
Is it possible to load a 2d map. I mean from what i know (2d tutorial on this site :D) u have to make a map and save it as a project or at least as source code. Well i might want to write a small map editor wich can save the maps with a certain extension, lets say .MAP , and then i would want to load these map's with the irrlicht engine. Is it possible , or am i completely off? :D
sorry for my noobness ;)
tnx in advance..
Guest

Post by Guest »

2d maps are just usually an array of tiles or a list of objects. for previous 2d projects, ive used a format like this.

struct Object {
int x, y;
std::string filename;
ITexture *texure;
};

when saving the map using std::ofstream the file would look like this ...

10 40 grass.bmp
50 30 brick.bmp
etc.

before loading the map you should load all textures and keep their filenames as well. then when loading the map you can search this list and create the objects which are described in your file you saved.

i have some source code for a 2d map editor, just ask if you would like to see some of it.
trisman
Posts: 9
Joined: Sat Jun 11, 2005 5:59 pm

Post by trisman »

can u login and post , so i can pm u on this subject 8) tnx btw :)
Post Reply