# musicgame **Repository Path**: heshushun/musicgame ## Basic Information - **Project Name**: musicgame - **Description**: pygame学习实现一个音乐游戏 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-11 - **Last Updated**: 2023-10-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: pygame ## README # musicgame music game by pygame # 规则 离中心越近越厉害 简单模式 \ 顺时针从 上 开始 \ w: 上 \ s: 下 \ a: 左 \ d: 右 顺时针从 右上 开始 \ 上箭头: 右上 \ 左箭头: 左上 \ 下箭头: 左下 \ 右箭头: 右下 复杂模式 \ ~~算了 太难玩了,角度随机~~ 详情 看图 assets/rule.jpg #yaml使用: 打开文件\ file = open('./defines.yaml','r',encoding='utf-8')\ 加载数据,转换后出来的data是字典\ data = yaml.load(file, Loader=yaml.FullLoader) #pygame教程: https://www.pygame.org/docs/ref/image.html \ http://c.biancheng.net/pygame/ pygame.init(): 使用pygame之前必须初始化 pygame.Rect(): 在 Pygame 中我们使用 Rect() 方法来创建一个指定位置 screen = pygame.display.set_mode(): 设置主屏窗口 pygame.image.load(): 加载图片 pygame.mixer.music.load(): 加载音频 pygame.mixer.music.play(): 播放音频 screen.blit(text,textRect): 绘制到屏幕上 pygame.event.get(): 监听事件 pygame.time.Clock(): 创建一个时钟对象来帮我们确定游戏要以多大的帧数运行 pygame.quit(): 卸载所有模块 pygame.display.flip(): 更新屏幕内容