self.image.set_colorkey(bg_color) pygame.draw.ellipse(self.image, color, [0,0, width, height]) self.rect =self.image.get_rect self.rect.left = x self.rect.top = y '''角色类''' classPlayer(pygame.sprite.Sprite): def__init__(self, x, y, role_image_path): pygame.sprite.Sprite...
'hero' + str(i) + '.png')).convert img.convert_alpha img.set_colorkey(ALPHA) self.images.append(img) self.image = self.images[0] self.rect = self.image.get_rect def jump(self,platform_list): self.jump_delta = 0 def gravity(self): self.movey += 3.2 # how fast player falls...
2018年8月3日pygame的安装和快速入门,飞机大战
self.ball = ball_surface.convert self.ball.set_colorkey((0,0,0)) self.font = pygame.font.SysFont("calibri",40) ''' 重置球和球拍的位置 ''' def__reset(self): self.paddle_1_pos = (10.,215.) self.paddle_2_pos = (620.,215.) self.ball_pos = (312.5,232.5) 2、行动决策机制: ...