def draw(self, surface):
mouse = pygame.mouse.get_pressed()
self.sound = Sound1
if not self.rect.collidepoint(pygame.mouse.get_pos()):
surface.blit(self.I, (self.rect))
elif self.rect.collidepoint(pygame.mouse.get_pos()):
if mouse[0]:
self.sound.play()
self.I = pygame.transform.scale(self.I, (int(self.sx * 1.02), int(self.sy * 1.02)))
self.rect = pygame.Rect((int(self.x - (self.sx * 1.02 - self.sx)), int(self.y - (self.sy * 1.02 - self.sy))), (int(self.sx), int(self.sy)))
self.srect = pygame.Surface((int(self.sx * 1.02), int(self.sy * 1.04)))
self.srect.fill(pygame.Color("Black"))
self.srect.set_alpha(68)
surface.blit(self.srect, (int(self.x), int(self.y)))
surface.blit(self.I, (self.rect))
评论列表
文章目录