1
Graphics / Re: Is there a method to have hit box detection with any other box?
« on: September 17, 2013, 01:38:47 am »
Yeah I plan on picking up I plan on getting SFML Game Development book, but I don't have the free time at the moment with my university (non-computer science major). I figured doing this was more productive than going to reddit lol. Thanks for your input, once I graduate and get a bit more free time I plan on getting more serious about learning.
I think I understand what you are saying though. I have a C++ book, which I am told is a terrible book, but I haven't gotten to vectors yet. I'm guessing they work similar to arrays, but are less resource intensive? In terms of arrays, I would set up enemy[10][30], and then could use one loop, with a loop inside to check for hitbox intersections against all 10 variants.
for(int k=0; k<10;k++){
for(int j=0; j<30;j++{
if(EnemyHitBox[k][j].intersects(PlayerLaserHitBox)){
//do something
}
}
}
I think I understand what you are saying though. I have a C++ book, which I am told is a terrible book, but I haven't gotten to vectors yet. I'm guessing they work similar to arrays, but are less resource intensive? In terms of arrays, I would set up enemy[10][30], and then could use one loop, with a loop inside to check for hitbox intersections against all 10 variants.
for(int k=0; k<10;k++){
for(int j=0; j<30;j++{
if(EnemyHitBox[k][j].intersects(PlayerLaserHitBox)){
//do something
}
}
}