Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Missqu

Pages: [1]
1
So I noticed something really weird. Passed sprites object has both width and height of 0.
so for example when I call my collision function and cout: mleczny->sprite.getGlobalbounds.height;
it will display zero, but for "this" pointer it gives correct parameters.
I think that passing object of my class somehow that object starts reffering to empty sprite ?

2
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!

Pages: [1]
anything