are you watching the right videos?? loleatcomics wrote:Dude this looks great! I absolutely can't wait to see more :D Keep up the awesomeness
*sub'd
BTW I FUCKING LOVE THE OFFSPRING!!!
carry on
anyway what i meant by i hear the girls of atlanta calling me actually meant a morning of uncertainty and solitude haha. blackouts, worthless!!!
hmm not familiar with that, i just wrote it myself quick ... actually its pretty ugly.... But I agree, I can see that it will quickly be VERY inefficient once there is more than 2 retarded looking zombies in the mixXianForce wrote:So your using pixel perfect collisions? I'm curious as to how good that is, in terms of effective vs efficient. I know it works well, but I would imagine that as you add more and more elements to check again, it will very quickly become unrealistic as a collision system.
But then again, I've never extensively used pixel-perfect, so let me know how it works out =D!
Code: Select all
int iLikeToHaveCollision( BITMAP* bmp1 , BITMAP* bmp2 , Player & rOne, Enemy & rEnemy, int w1, int h1, int w2, int h2)
{
//check to see if they are even close enough to intersect
if ( rOne.GetItsX() > rEnemy.GetHisX() - w1 && rOne.GetItsX() - w2 < rEnemy.GetHisX()
&& rOne.GetItsY() > rEnemy.GetHisY() -h1 && rOne.GetItsY() - h2 < rEnemy.GetHisY())
{
// take difference in locations to make origin 0,0 for reference
int xOffset = 0;
int yOffset = 0;
if (rOne.GetItsX() > rEnemy.GetHisX())
xOffset = rOne.GetItsX() - rEnemy.GetHisX();
else
xOffset = -rOne.GetItsX() + rEnemy.GetHisX();
if(rOne.GetItsY() > rEnemy.GetHisY())
yOffset = rOne.GetItsY() - rEnemy.GetHisY();
else
yOffset = -rOne.GetItsY() + rEnemy.GetHisY();
int **bmp1Array;
int **bmp2Array;
bmp1Array = new int*[w1];
bmp2Array = new int*[w2];
for (int i = 0; i < h1; ++i)
bmp1Array[i] = new int[h1];
for (int i = 0; i < h2; ++i)
bmp2Array[i] = new int[h2];
// De-Allocate memory to prevent memory leak
for(int j = 0 ; j < h1; j++)
{
for(int i = 0 ; i < w1; i++)
{
if (getr(getpixel(bmp1,i,j)) != 255 &&
getg(getpixel(bmp1,i,j)) != 0 &&
getb(getpixel(bmp1,i,j)) != 255)
{
bmp1Array[i][j] = 1;
}
else
bmp1Array[i][j] = 0;
}
}
for(int j = 0 ; j < h2; j++)
{
for(int i = 0 ; i < w2; i++)
{
if (getr(getpixel(bmp2,i,j)) != 255 &&
getg(getpixel(bmp2,i,j)) != 0 &&
getb(getpixel(bmp2,i,j)) != 255)
{
bmp2Array[i][j] = 1;
}
else
bmp2Array[i][j] = 0;
}
}
for(int j = 0 ; j < h1; j++)
{
for(int i = 0 ; i < w1; i++)
{
if (bmp1Array[i][j])
{
if( i <= w1 - xOffset && j <= h1 - yOffset && bmp2Array[i + xOffset-1][j + yOffset-1])
{
// De-Allocate memory to prevent memory leak
for (int i = 0; i < h1; ++i)
delete [] bmp1Array[i];
delete [] bmp1Array;
for (int i = 0; i < h2; ++i)
delete [] bmp2Array[i];
delete [] bmp2Array;
return 1;
}
}
}
}
for(int j = 0 ; j < h2; j++)
{
for(int i = 0 ; i < w2; i++)
{
if (bmp1Array[i][j])
{
if( i <= w2 - xOffset && j <= h2 - yOffset && bmp2Array[i + xOffset-1][j + yOffset-1])
{
// De-Allocate memory to prevent memory leak
for (int i = 0; i < h1; ++i)
delete [] bmp1Array[i];
delete [] bmp1Array;
for (int i = 0; i < h2; ++i)
delete [] bmp2Array[i];
delete [] bmp2Array;
return 1;
}
}
}
}
// De-Allocate memory to prevent memory leak
for (int i = 0; i < h1; ++i)
delete [] bmp1Array[i];
delete [] bmp1Array;
for (int i = 0; i < h2; ++i)
delete [] bmp2Array[i];
delete [] bmp2Array;
}
return 0;
}
//wait, delete how many times?
im actually kind of excited about the story line i have going now,, ahhhhhh!!!! maybe that will jump to phase 1 and 2 ;)