Whenever I try compiling the code(Which is handling collision between two sprites) I get an error.
This is only a portion of what I'm having a problem with, and yes it's all linked, libraries are included and everything.
It even compiled succesfully before but when I modified what happens when an error occurs (Texture failed to load, font failed to load, etc) it came up with a problem here.
If any more information is needed please ask.
bool Collision::SpritetoSprite(sf::Sprite sprite, sf::Sprite sprite2)
{
if(sprite.getPosition().x < sprite2.getPosition().x + sprite2.getTexture().getSize().x && sprite.getPosition().x > sprite2.getPosition().x &&
sprite.getPosition().y < sprite2.getPosition().y + sprite2.getTexture().getSize().y && sprite.getPosition().y > sprite2.getPosition().y)
{
return true;
}else
{
return false;
}
}
And the error:
C:\Users\Nicholas\Desktop\Projects\SFML2.1 Game\Collision.cpp
line:|30|
error: request for member 'getSize' in 'sprite2.sf::Sprite::getTexture()', which is of pointer type 'const sf::Texture*' (maybe you meant to use '->' ?)|
The error also appears for line 31.
I have no idea what this error is implying or how to fix it.