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.


Topics - bobo68

Pages: [1]
1
i'm trying to make an object rotate around its center, so i did this:
sprite.setOrigin(object.scale * .5);
sprite.setScale(object.scale);
and in a separate function i rotate the object by some amount every frame

the problem is that it doesn't work, and the object still doesn't rotate around the center, even though all solutions i found online say it should work like this.

but there's another weird thing: from what it looks on the sprite (https://www.sfml-dev.org/tutorials/2.5/graphics-sprite.php) tutorial page, textures should resize to what their host sprite's rectangle size is. the fact is that the texture (that I load from file and set using sprite.setTexture(texture)) seems to not do this because I loaded two different sized textures and, setting scale to (1,1), the resulting images on the window were of different sizes. the rescaling still works, but I thought that setting both sizes to (1,1) would make both sprites appear the same size. I'm saying this because this made me think that it could be a problem with this: the sprite's center point is actually being correctly set but the image is too big, so it goes beyond the size of the sprite.

does anyone know what's happening? is it a setOrigin problem or a texture problem? did i misunderstand how either of these work?
also let me know if something wasn't too clear, i probably didn't explain very well

Pages: [1]