♥️作者:小刘在这里
♥️每天分享云计算网络运维课堂笔记,努力不一定有收获,但一定会有收获加油!一起努力,共赴美好人生!
♥️夕阳下,是最美的,绽放,愿所有的美好,再疫情结束后如约而至。
目录
一。效果呈现
二.主代码
三.cfg
四.README
一.效果呈现
二.主代码
'''
Function:打砖块小游戏'''
import cfg
from modules import breakoutClone'''主函数'''
def main():game = breakoutClone(cfg)game.run()'''run'''
if __name__ == '__main__':main()
三.cfg
'''配置文件'''
import os'''游戏界面一些数值'''
SCREENWIDTH = 640
SCREENHEIGHT = 480
BRICKWIDTH = 10
BRICKHEIGHT = 10
PADDLEWIDTH = 60
PADDLEHEIGHT = 12
BALLRADIUS = 8
'''游戏素材路径'''
FONTPATH = os.path.join(os.getcwd(), 'resources/font/font.TTF')
HITSOUNDPATH = os.path.join(os.getcwd(), 'resources/audios/hit.wav')
BGMPATH = os.path.join(os.getcwd(), 'resources/audios/bgm.mp3')
LEVELROOTPATH = os.path.join(os.getcwd(), 'resources/levels')
LEVELPATHS = [os.path.join(LEVELROOTPATH, '%s.level' % str(i+1)) for i in range(len(os.listdir(LEVELROOTPATH)))]
'''一些颜色'''
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
PINK = (0, 199, 140)
PURPLE = (0, 199, 140)
YELLOW = (255, 0, 0)
BLUE = (0, 0, 0)
AQUA = (192, 192, 192)
四.README
# Introduction
https://mp.weixin.qq.com/s/9tNVTA06dFthdugNs3TePA
# Environment
```
OS: Windows10
Python: Python3.5+(have installed necessary dependencies)
```
# Usage
```
Step1:
pip install -r requirements.txt
Step2:
run "python Game18.py"
```
# Game Display
![giphy](demonstration/running.gif)
♥️关注,就是我创作的动力
♥️点赞,就是对我最大的认可
♥️这里是小刘,励志用心做好每一篇文章,谢谢大家