I have made several "maps" and would like an easy way to call all of them into a function.
the maps look similiar to:
char map1[2][4]={{g,g,g,g},
{g,w,w,g}};
now to call it into a function i merely did...
so that all works good and fine...until a character walks off the edge of the map...Code:int MAPFUNCTION(char Pmap[20][40],int sx,int sy,int drct) { for(x=0;x<20;x++) { for(int y=0;y<40; y++) { PMap[x][y]; if(PMap[x][y]==g) {fgreen;} if(PMap[x][y]==c) { charX=x; charY=y; fiblue; } if(PMap[x][y]==w) {grey;} if(PMap[x][y]==r) {fblue;} if(PMap[x][y]==d) {brown;} cout<<PMap[x][y]; } cout<<endl; } }
i need someway to call in the next map...which i could do if I could put each of the maps into an array...or something similiar...just wondering what i could do...
BTW:i cut alot out of my code...so its small enough to glance over...



LinkBack URL
About LinkBacks


