python小游戏——塔防小游戏代码开源

♥️作者:小刘在这里

♥️每天分享云计算网络运维课堂笔记,努力不一定有收获,但一定会有收获加油!一起努力,共赴美好人生!

♥️夕阳下,是最美的,绽放,愿所有的美好,再疫情结束后如约而至。

目录

一.效果呈现

二.主代码

三.cfg

四.README


一.效果呈现

二.主代码

'''
Function:
    塔防游戏
源码基地:#959755565#
'''
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)

♥️关注,就是我创作的动力

♥️点赞,就是对我最大的认可

♥️这里是小刘,励志用心做好每一篇文章,谢谢大家

评论 33
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小刘在C站

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值