#define PLAYER 1
#define ENEMY 2
#define WALL 3
class Thing
{
public:
virtual void update()=0;
virtual void draw()=0;
int TYPE;
};
class Player : public Thing
{
public:
int vx , vy;
Player()
{
TYPE=PLAYER;
}
}
class Enemy : public Thing
{
public:
int vx , vy;
bool chase;
Enemy()
{
TYPE=ENEMY;
}
}
i sad imam funckiju
collision( Thing *A, Thing *B )
{
if(A.TYPE==PLAYER && B.TYPE==WALL)
{
if(collision_test(A,B))
A.vx=0; // PROBLEM, nemam pristup vx
}
if(A.TYPE==PLAYER && B.TYPE==ENEMY)
{
if(collision_test(A,B))
B.chase=true; //PROBLEM, nemam pristup promenjivi chase...
}
...............................
}
Moze li se ovo nekako resiti?