I guess I should've been posting here all along. Anyway: I'm working on a game using an external game programming library (allegro) but I want to use an object as a generic data holder structure to test for collisions. object being used is "area" and its being used in player class called "program9handler"
area.h:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#ifndef AR_H
#define AR_H
class area
{
public:
area();
~area();
void initialize();
struct pt {
int x;
int y;
int set;
} tl,tr,bl,br;
int x,y,width,height;
private:
};
#endif
jdd:p9wbullets jdd$ g++ -c program9handler.cpp
program9handler.h:31: error: field ‘areas’ has incomplete type
program9handler.cpp: In member function ‘void program9handler::sethitboundaries(BITMAP*, int)’:
program9handler.cpp:209: error: ‘tl’ was not declared in this scope
program9handler.cpp:210: error: ‘areas’ was not declared in this scope
program9handler.cpp:221: error: ‘areas’ was not declared in this scope
program9handler.cpp:231: error: ‘areas’ was not declared in this scope
program9handler.cpp:241: error: ‘areas’ was not declared in this scope
program9handler.cpp: In member function ‘void program9handler::checkcollision(program9handler)’:
program9handler.cpp:264: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:265: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:267: error: ‘areas’ was not declared in this scope
program9handler.cpp:278: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:279: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:281: error: ‘areas’ was not declared in this scope
program9handler.cpp:292: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:293: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:295: error: ‘areas’ was not declared in this scope
program9handler.cpp:306: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:307: error: ‘class program9handler’ has no member named ‘areas’
program9handler.cpp:309: error: ‘areas’ was not declared in this scope
In retrospect I probably didn't need to do that I just thought it would be easier for collision detection across multiple objects since I was trying to add the ability to shoot. the method above, as you can guess, is reading a bitmap and finding the areas where the color changes from the background color to something else to create a collision detection area.