Page 1 of 1

Can someone teach me map loading?

PostPosted: Sat Jun 06, 2009 2:49 am
by jimmynewguy
I want to load maps from external files, yes i know there is a demo on this, but it uses .txt which anyone can edit or in otherwords change the game.

The only example I have seen of this is Pyro's Game Over Land and i really couldn't figure that one out with the map editor and all. (But come on, it's not broken down, and well it's pyro XD) So i was wondering if anyone out there would be kind enough to teach me how to do this. I would extremly appreciate it, and I could make times better games with this.
Thanks in advanced.

Re: Can someone teach me map loading?

PostPosted: Sat Jun 06, 2009 6:11 am
by skydereign
Well, you can still alter the files that pyro has... at least I can. But you would like it to be non legible? The reason those .room files are used is that you don't know how to change it, but you can still access it. Is that okay? I might be able to explain a similar method if you like.

Re: Can someone teach me map loading?

PostPosted: Sat Jun 06, 2009 8:33 am
by Bee-Ant
Why dont you make the file as .dll or .dat or whatever so that people wouldnt notice it???
Or just use your own encoding...
maybe write @#e% for 1, or a7r% for 2, etc...so although they can open the file, they wouldnt understand what its mean... :D

Re: Can someone teach me map loading?

PostPosted: Sat Jun 06, 2009 1:34 pm
by jimmynewguy
ya sky that's what i mean. Like i want ME to be able to change it, but not whoever downloads it, and BeeAnt, that's a nice idea, but can GE read a .dll?

Re: Can someone teach me map loading?

PostPosted: Sat Jun 06, 2009 2:46 pm
by Bee-Ant
Why not?
I said that because i already do that.. :D
If you want to use your own encoding.save and load the file as char,and encode it using strcmp...
Code: Select all
int i,j,value;
char var[limit][limit];
FILE *map=fopen("map1.dll","r");
for(i=0;i<limit;i++)
{for(j=0;j<limit;j++)
{fscanf(map,"%s%",&var[i][j]);
if(!strcmp(var[i][j],"7a&%"))value=1;
if(value==1)//creates map with specified sprite
if(value==2)//etc
}}
fclose(map);

Thats the basic i think :D