I just want a very simple rotation, for a fairly square shaped image to rotate about it's center.
How I have it set up so far is that the displayable has a function for rotating:
Code: Select all
def rotate(self, deg):
#Transform the image
xcenter = (self.dimensions[0]/2)
ycenter = (self.dimensions[1]/2)
self.image = Transform(child=self.image, anchor=(xcenter,ycenter), rotate=deg, subpixel=False)
This is called during the displayables update().
When I run the test, the displayable is definitely rotating, but it seems to be rotating around some arbitrary point off screen.
I only see it for a moment before it very quickly moves in a curved path off of the screen.
I have tried changing the anchor, and defining it in relationship to the top left of the displayable, and to the top left of the game screen, neither work.
I also tried setting the 'around' property, but it still gives me the same result.
Also to note, In case it affects things. The image that I want to rotate is in constant motion on the screen so its x,y position is changing.
I am trying to create the effect that an object is moving in a straight line and spinning.
I am using a creator defined displayable and not ATL or the sprite manager because the displayable actually does quite a bit more. (collision detection, etc.)