well i hope u can answer this:
i have a class shooter;
class shooter
{
...
protected:
unsigned int width;
unsigned int height;
static sf::Image Image;
sf::Sprite Sprite;
public :
void scale(float x, flaot y);
}
when my object is created, width and height are taken from its image:
shooter::shooter()
{
Sprite.SetImage(Image); // every sprite uses the same unique image
width = Image.GetWidth();
height = Image.GetHeight();
Position = Sprite.GetPosition();
}
when it´s scaled the sprite should be scaled AND width and height should be re-calculated, what i tried like this:
void shooter::Scale(float x, float y)
{
Sprite.Scale(x,y);
width = width * x;
height= height * y;
}
i tried it, but when i let my program write width and height i have a problem; it´s not always correct;
whats the mistake in my code?