Edit: Actually I noticed that the offsets only happens when I rotate by certain degrees, so when I rotate 90,180,270 degrees there is no offset.
So I think I still need to experiment a little with this, since the reason does not appear to be rotating multiple times, but by what degree one rotates.
This was the original post
I am rotating object sprites, using dynamic sprites.
The first rotation works fine. But when I rotate it a second time, there is a little offset, it's about 33 pixels too far to the right and up.
The script I used:
In the script body:
Code: ags
Then in room after fade in:
Code: ags
So the first time it rotates normally the way I want it, too, and from the second time on there is this offset there.
I can fix it by simply moving the object 33 pixels left and down (-33 pixels on x-coordinate, 33 pixels on y-coordinate) after the first rotation, but I would like to understand why this happens in the first place, so that if I have more complicated things to rotate, I can calculate and asses exactly how big the offset is going to be, and not just fix it by eye sight and estimating the offset.
Does anyone have an idea why this happens?
It's exactly the same when I draw overlays instead of object sprites...
Thanks
So I think I still need to experiment a little with this, since the reason does not appear to be rotating multiple times, but by what degree one rotates.
Spoiler
This was the original post
I am rotating object sprites, using dynamic sprites.
The first rotation works fine. But when I rotate it a second time, there is a little offset, it's about 33 pixels too far to the right and up.
The script I used:
In the script body:
DynamicSprite* shower;
Then in room after fade in:
shower=DynamicSprite.CreateFromExistingSprite(723, true);
shower.Rotate(90);
oindicator.Graphic =shower.Graphic;
Wait(20);
shower=DynamicSprite.CreateFromExistingSprite(723, true);
shower.Rotate(47);
oindicator.Graphic =shower.Graphic;
Wait(20);
shower=DynamicSprite.CreateFromExistingSprite(723, true);
shower.Rotate(154);
oindicator.Graphic =shower.Graphic;
Wait(20);
shower=DynamicSprite.CreateFromExistingSprite(723, true);
shower.Rotate(238);
oindicator.Graphic =shower.Graphic;
Wait(20);
So the first time it rotates normally the way I want it, too, and from the second time on there is this offset there.
I can fix it by simply moving the object 33 pixels left and down (-33 pixels on x-coordinate, 33 pixels on y-coordinate) after the first rotation, but I would like to understand why this happens in the first place, so that if I have more complicated things to rotate, I can calculate and asses exactly how big the offset is going to be, and not just fix it by eye sight and estimating the offset.
Does anyone have an idea why this happens?
It's exactly the same when I draw overlays instead of object sprites...
[close]