Hello everyone,
So I had class A, and class B, and external function that would check collision for me. It looked something like that
bool collision(*A a, *B )
{
if (a->sprite.getGlobalBounds().intersects(b->sprite.getGlobalBounds()) &&
b->sprite.getGlobalBounds().intersects(a->sprite.getGlobalBounds()))
{
return true;
}
}
then I made parent class and put checking collision there
bool collision(parentclass *mleczny)
{
if (this->sprite.getGlobalBounds().intersects(mleczny->sprite.getGlobalBounds()) &&
mleczny->sprite.getGlobalBounds().intersects(this->sprite.getGlobalBounds()))
{
return true;
}
}
but after using it on my subclass A
a.collision(&b);
it keeps returning false. Also I had few other functions that I used in both classes and put them into my parent class and they work just fine!