Hi,
I'm new so bear with me.
I am putting together a game called "flyswat" which has flies crawling over the screen, and a swatter you use to hit them. Now I have these questions.
1. I have images for the fly and the swatter, now I'd like to be able to rotate them to different angles - is this possible in pygame??
2. In the mean time I have used gimp to give me a whole series of rotated images.
I load them into memory one by one like this -
img_fly = [] for i in range(12): name = 'fly'+str(i)+'.png' img_fly.append(load_image(name))
- and I use them like this -
self.display_surface.blit(img_fly[self.direction], self.rect)
- does that make sense? Like I say, I'd like to be able to rotate the images through any angle.
3. when I move the image, I am blitting out the previous image with background and then blitting the new image. The problem is that there is more than one fly image that can overlap - that means that when I blit a rect in background colour before the blit for the 2nd fly, it overwrites part of the 1st fly image- how can I fix this? The fly images themselves have a transparent background. I could create more images just of the image outlines filled with background color, and do something like this -
# blot out just non-transparent parts of the old image self.display_surface.blit(img_fly_mask[self.direction], self.rect) (self.direction, self.rect) = self.move_fly self.display_surface.blit(img_fly[self.direction], self.rect)
- but is there an easier way to get overlapping images?