|
Maps for Liqwiid Wars June 30, 2009 12:55PM | Registered: 16 years ago Posts: 17 |
|
Re: Maps for Liqwiid Wars June 30, 2009 04:12PM | Registered: 16 years ago Posts: 42 |
{
//DO NOT copy paste this code, it won't work. This is just to give you a concept of how to go about
//solving your problem.
int imgwidth = 4;
for (int i=0; i<sizeof(bitmap); i++)
{
//we assume you extracted bitmap to some kind of array
//you could also do bitmap as it is the same thing as *(bitmap+i);
if (*(bitmap+i) == 1)
{
//addobject is a magic function that adds a collidable box to some collection
//addobject( x , y )
addobject(i%imgwidth,i/imgwidth);
}
}
}
|
Re: Maps for Liqwiid Wars June 30, 2009 04:33PM | Registered: 16 years ago Posts: 17 |
Quote
CloneDeath
lol, there is no magic "convert_bmp_to_easycollidable_array_of_objects()" function.
I hate to say this, but to ruin your hopes and dreams:
-Programming isn't magic
-Standard official C++ isn't as standard and official as you would think.
|
Re: Maps for Liqwiid Wars June 30, 2009 05:04PM | Registered: 16 years ago Posts: 42 |
tempobj = new myBlock(x,y); myvector.push_back(tempobj);
myvector.push_back(new myBlock(x,y));
|
Re: Maps for Liqwiid Wars June 30, 2009 08:58PM | Registered: 16 years ago Posts: 116 |
|
Re: Maps for Liqwiid Wars June 30, 2009 09:08PM | Registered: 16 years ago Posts: 42 |
|
Re: Maps for Liqwiid Wars June 30, 2009 09:19PM | Registered: 16 years ago Posts: 116 |
Quote
CloneDeath
There are no standard library or any libraries at that which will do the work for him.
The only routines I can think of would just load the image into a usable form. After that, he has to write his own interpreter for the data.
|
Re: Maps for Liqwiid Wars June 30, 2009 09:32PM | Registered: 16 years ago Posts: 42 |
|
Re: Maps for Liqwiid Wars June 30, 2009 10:14PM | Registered: 16 years ago Posts: 17 |
|
Re: Maps for Liqwiid Wars July 01, 2009 12:21AM | Registered: 16 years ago Posts: 42 |
|
Re: Maps for Liqwiid Wars July 02, 2009 08:53AM | Registered: 16 years ago Posts: 17 |
|
Re: Maps for Liqwiid Wars July 02, 2009 09:41PM | Registered: 16 years ago Posts: 42 |
copymaptoscreen(){
for each (x in maparray){
for each (y in maparray)
{
screen[x][y] = maparray[x][y]==1?WHITE_COLOR:BLACK_COLOR;
}
}
}
how it works should be self explanitory. If you are unfamiliar with how "?:" works, just tell me, and I will explain what that did in terms of if and else (no use explaining it if you already know :P)111111111 110001001 100001001 100000001 111111111
char maparray[ ][ ] =
{{1,1,1,1,1,1,1,1,1},
{1,1,0,0,0,1,0,0,1},
{1,0,0,0,0,1,0,0,1},
{1,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1}};