Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
ninetailskim 743aa4affc | 2 years ago | |
---|---|---|
resources | 2 years ago | |
.gitignore | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
duanwu.py | 2 years ago | |
requirements.txt | 2 years ago |
上次直播的最后和大家简单聊了一下换皮.因为直播讲的和github上release上有一些差别(直播讲了一些打算要改进的地方),所以想着干脆重构一下吧.
恰巧碰上了端午节,所以干脆再重写一些逻辑,做个端午节定制小游戏吧.
游戏的贴图全换成了端午节相关贴图:三种粽子造型
雄黄酒
以及五毒:蛇,壁虎,蜈蚣,蟾蜍,蟹子
其实五毒也是我在逛了粽子博物馆才看到的哈哈哈,所以虽然做的是个游戏,但是也是有一些科普的性质在里面的.
其实除了避五毒,端午节还要吃五黄,分别是:黄鳝,黄鱼,黄瓜,黄泥蛋以及雄黄酒.
故人认为端午仲夏,"五毒"大量繁殖,易咬伤人,吃了"五黄"能够抵御"五毒"的侵害.
是不是觉得又掌握了一些小知识呢~
由于需要摄像头,所以无法在aistudio上运行,请clone github仓库到本地运行.
python duanwu.py --level(optional)
改变了之前可以随便移动的控制方式,这次控制的小熊只能在屏幕的最低端左右移动.根据摄像头的图像,映射出X轴的位置即可.
游戏一共100秒.
吃到粽子会加100分.
吃到雄黄酒会进行一次清屏一次性加1000分,但是喝酒后会左右颠倒进入眩晕状态,要注意操作方式.在眩晕的期间,吃到粽子分值翻倍.
吃到五毒的话......会直接结束游戏,哈哈,要注意喽
在直播中给大家讲了做游戏的一中单例设计模式,Manager的概念.(当然,这不是一种很好的方式,但是做这种简单的小游戏已经完全足够)
这次代码重构,则完全按照直播的规划来重构的.重新设计了UIManager, ResourceManager, GameManager, BallManager等等.代码的可读性更高更简洁,耦合性则更低.
利用Paddlehub制作端午体感小游戏
Python Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》