当前位置:   article > 正文

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

python塔防游戏代码

♥️作者:小刘在这里

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

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

目录

一.效果呈现

二.主代码

三.cfg

四.README


一.效果呈现

二.主代码

  1. '''
  2. Function:
  3. 塔防游戏
  4. 源码基地:#959755565#
  5. '''
  6. import cfg
  7. import pygame
  8. from modules import *
  9. '''主函数'''
  10. def main():
  11. pygame.init()
  12. pygame.mixer.init()
  13. pygame.mixer.music.load(cfg.AUDIOPATHS['bgm'])
  14. pygame.mixer.music.play(-1, 0.0)
  15. pygame.mixer.music.set_volume(0.25)
  16. screen = pygame.display.set_mode(cfg.SCREENSIZE)
  17. pygame.display.set_caption("保卫基地——塔防游戏 ")
  18. # 调用游戏开始界面
  19. start_interface = StartInterface(cfg)
  20. is_play = start_interface.update(screen)
  21. if not is_play:
  22. return
  23. # 调用游戏界面
  24. while True:
  25. choice_interface = ChoiceInterface(cfg)
  26. map_choice, difficulty_choice = choice_interface.update(screen)
  27. game_interface = GamingInterface(cfg)
  28. game_interface.start(screen, map_path=cfg.MAPPATHS[str(map_choice)], difficulty_path=cfg.DIFFICULTYPATHS[str(difficulty_choice)])
  29. end_interface = EndInterface(cfg)
  30. end_interface.update(screen)
  31. '''run'''
  32. if __name__ == '__main__':
  33. 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)

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

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

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/92104
推荐阅读
相关标签
  

闽ICP备14008679号