import pygame class Settings: def __init__(self): self.bg_color = (0, 0, 0) # 背景颜色 self.width = 400 self.height = 400 self.cell_size = 20 # 格子大小 self.cell_w = int(self.width / self.cell_size) # 一行的格子数 self.cell_h = int(self.height / self.cell_size) # 一列的格子数 self.num = self.cell_w * self.cell_h self.game_mode = 0 # 游戏状态 self.score = 0 # 游戏得分 self.clock_frq = 5 # 刷新频率 self.my_clock = pygame.time.Clock()