♥️作者:小刘在这里
♥️每天分享云计算网络运维课堂笔记,努力不一定有收获,但一定会有收获加油!一起努力,共赴美好人生!
♥️夕阳下,是最美的,绽放,愿所有的美好,再疫情结束后如约而至。
目录
一.效果呈现
二.主代码
三.cfg
四.README
一.效果呈现
二.主代码
'''
Function:
塔防游戏
源码基地:#959755565#
csdn账号:顾木子吖
公众号:Python顾木子吖
'''
import cfg
import pygame
from modules import *
'''主函数'''
def main():
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(cfg.AUDIOPATHS['bgm'])
pygame.mixer.music.play(-1, 0.0)
pygame.mixer.music.set_volume(0.25)
screen = pygame.display.set_mode(cfg.SCREENSIZE)
pygame.display.set_caption("保卫基地——塔防游戏 ")
# 调用游戏开始界面
start_interface = StartInterface(cfg)
is_play = start_interface.update(screen)
if not is_play:
return
# 调用游戏界面
while True:
choice_interface = ChoiceInterface(cfg)
map_choice, difficulty_choice = choice_interface.update(screen)
game_interface = GamingInterface(cfg)
game_interface.start(screen, map_path=cfg.MAPPATHS[str(map_choice)], difficulty_path=cfg.DIFFICULTYPATHS[str(difficulty_choice)])
end_interface = EndInterface(cfg)
end_interface.update(screen)
'''run'''
if __name__ == '__main__':
main()
三.cfg
# Introduction
https://mp.weixin.qq.com/s/mcnN3dF5tzWlRg91cnWTEw
# Environment
```
OS: Windows10
Python: Python3.5+(have installed necessary dependencies)
```
# Usage
```
Step1:
pip install -r requirements.txt
Step2:
run "python Game8.py"
```
# Game Display
![giphy](demonstration/running.gif)
四.README
# Introduction
https://mp.weixin.qq.com/s/mcnN3dF5tzWlRg91cnWTEw
# Environment
```
OS: Windows10
Python: Python3.5+(have installed necessary dependencies)
```
# Usage
```
Step1:
pip install -r requirements.txt
Step2:
run "python Game8.py"
```
# Game Display
![giphy](demonstration/running.gif)
♥️关注,就是我创作的动力
♥️点赞,就是对我最大的认可
♥️这里是小刘,励志用心做好每一篇文章,谢谢大家