You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
354 B

6 months ago
import pygame
class Item(pygame.sprite.Sprite):
def __init__(self,x,y,w,h,name):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((w,h)).convert() # 添加一个空的图层使其各自有一个宽高
self.rect = self.image.get_rect()
self.rect.x = x
self.rect.y = y
self.name = name