Hey,
I wrote a function similar like:
int more(sf::Sprite rect)
{
if(sf::Keyboard::isKeyPresed(sf::Keyboard::Up))
{
rect.scale(1.1,1.1)
return 1;
}
return 0;
}
(...)
int return = more(rect);
But now my rectangle doesn't change. I think this is because you can return only 1 value (here it is the int). Is there any simple solution for my problem? Sry, I'm a beginner ;)
Don't say "Why you need a function for that", the real function is much bigger...
Thanks,
5gum
try:
int more(const sf::Sprite& rect)
Also, pass the sprite's bounting box instead with the sf::Sprite::getGlobalBounds function.
and what is this?:
int return = more(rect);
I'm surprised that line doesn't create an error. You don't give a return statement a variable type.