Jamescox
04-21-2011, 09:10 AM
Im making a basic box game which involves moving boxes around a maze and pushing other boxes, im new to collision detection but am able to get my head around it. The thing I can't get my head around though is why this function won't work.
note: This isn't the final function it is just the basic outline of what needs to be done.. once this works i'll be able to do it all.
typedef struct {
float x;
float y;
float z;
} point3D;
typedef struct {
point3D min;
point3D max;
} boundingBox;
boundingBox * wallBox[9];
boundingBox * playerBox;
//and then I had two functions that gave each boundingBox its values
int collisionWall(){
int i;
for(i = 0; i < 9; i++){
if(wallBox[i].min.x; =< playerBox.min.x;){
return 1;
}
return 0;
}
}
}
The errors I get are...
Error 1 error C2231: '.min' : left operand points to 'struct', use '->'
Error 2 error C2231: '.min' : left operand points to 'struct', use '->'
Error 3 error C2059: syntax error : '<'
Error 4 error C2059: syntax error : '}'
note: This isn't the final function it is just the basic outline of what needs to be done.. once this works i'll be able to do it all.
typedef struct {
float x;
float y;
float z;
} point3D;
typedef struct {
point3D min;
point3D max;
} boundingBox;
boundingBox * wallBox[9];
boundingBox * playerBox;
//and then I had two functions that gave each boundingBox its values
int collisionWall(){
int i;
for(i = 0; i < 9; i++){
if(wallBox[i].min.x; =< playerBox.min.x;){
return 1;
}
return 0;
}
}
}
The errors I get are...
Error 1 error C2231: '.min' : left operand points to 'struct', use '->'
Error 2 error C2231: '.min' : left operand points to 'struct', use '->'
Error 3 error C2059: syntax error : '<'
Error 4 error C2059: syntax error : '}'