https://github.com/czl0325/planewar
飞机大战游戏,使用python的pygame开发
https://github.com/czl0325/planewar
Last synced: 3 months ago
JSON representation
飞机大战游戏,使用python的pygame开发
- Host: GitHub
- URL: https://github.com/czl0325/planewar
- Owner: czl0325
- License: apache-2.0
- Created: 2019-12-26T03:32:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-30T03:19:20.000Z (over 5 years ago)
- Last Synced: 2025-01-22T16:47:31.975Z (5 months ago)
- Language: Python
- Size: 52.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PlaneWar
飞机大战游戏,使用python的pygame开发### pygame开发步骤
##### 1. init初始化
```
# 1. 创建游戏的窗口
self.screen = pygame.display.set_mode(SCREEN_RECT.size)
# 2. 创建游戏的时钟
self.clock = pygame.time.Clock()
```##### 2. 游戏循环
```
def start_game(self):
while True:
# 1. 设置刷新帧率
self.clock.tick(60)
# 2. 事件监听
self.__event_handler()
# 3. 碰撞检测
self.__check_collide()
# 4. 更新/绘制精灵组
self.__update_sprites()
# 5. 更新显示
pygame.display.update()
```