I`m on my way to create the Event Manager for my game. It`s a wip so please don`t get upset if there is not much to comment about yet. I have a reasonable understanding of what needs to be done I think, but I need validation of my work. I will post both the collision detection and all the other events involved in a RTS. For now here is my collision detection algorithm
void CheckCollisions(arim * Top, arim * Bott, arim * Left, arim * Right, ints * Ints, arim* CollidingActors,arbm * Available,arbm* OldNewTable)
{
int ActorCount = Ints[0].ActorCount;
for(int m =0; m < ActorCount; m++)
{
for(int n =0; n < ActorCount; n++)
{
if((Top[0].G(m) < Top[0].G(n)&& //11
Top[0].G(m) > Bott[0].G(n)&&
Left[0].G(m) > Left[0].G(n)&&
Left[0].G(m) < Right[0].G(n))
||
(Top[0].G(m) < Top[0].G(n)&& //1
Top[0].G(m) > Bott[0].G(n)&&
Right[0].G(m) > Left[0].G(n)&&
Right[0].G(m) < Right[0].G(n))
||
(Bott[0].G(m,1) < Top[0].G(n)&& //5
Bott[0].G(m,1) > Bott[0].G(n)&&
Right[0].G(m,0) > Left[0].G(n)&&
Right[0].G(m,0) < Right[0].G(n))
||
(Bott[0].G(m,1) < Top[0].G(n)&& //7
Bott[0].G(m,1) > Bott[0].G(n)&&
Left[0].G(m,0) > Left[0].G(n)&&
Left[0].G(m,0) < Right[0].G(n)))
{
SaveCollision(m,n,CollidingActors,Available,ActorCount,OldNewTable);
}
}
}
}
void SaveCollision(int first, int second, arim* CollidingActors, arbm * Available, int ActorCount, arbm* OldNewTable)
{
bool collisionexists = false;
for(int i = 0; i < ActorCount; i++)
{
if(!Available[0].G(i))
{
}
}
}
void MakeCollisonOld(arbm* OldNewTable, int ActorCount)
{
}