Aug-24-2021, 08:22 PM
(This post was last modified: Aug-24-2021, 08:47 PM by deanhystad.)
You need to do a rotate and a move. The rotate you probably already have (I am not going to install pygame to verify). The move is not that bad. You could steal the code from Point.rotate_z.
As for the "black square", that is the background of the image/surface/sail. You need to make the background transparent
def rotate_z(self, angle, center=(0, 0, 0)): cx, cy, cz = center x = self.x - cx y = self.y - cy d = math.hypot(y, x) theta = math.atan2(y, x) + angle self.x = cx + d * math.cos(theta) self.y = cy + d * math.sin(theta)The self.x and self.y would be the center of the rectangle/image/surface/sail. The cx and cy the point about which you want the sail to rotate. It shouldn't be difficult to strip this code out of the class and make it a function.
As for the "black square", that is the background of the image/surface/sail. You need to make the background transparent