python抢收成语双人创意游戏主程序

python 抢收成语双人创意游戏l作者:李兴球 lixingqiu

"""这是一个双人小游戏,在屏幕上会时不时的出现一些成语,玩家操作小方块去碰这些成语即可得分。

制作日期:2018/9月,这是去年制作的一个作品,成语的gif图片是用photoshop一个个制作的。其实可以用pillow自动生成。

"""
 
from writer import *        # 从writer模块导入Writer类
from idiom import *         # 导入成语表 idiomList和Idiom类
from square import *        # 导入方块类 Square
from time import sleep      # 从时间模块导入延时命令
from turtletools import *   # 从turtletools模块导入所有命令 
         
def clearlines():
    """清除方块所画的线条图形"""
    [square.clear() for square in squares] 
    
def end_of_countdown():
    """倒计时结束游戏"""
    global gametime
    if gametime>0:
        gametime = gametime - 1
        screen.ontimer(end_of_countdown,1000)
    else:
        """停止所有方块的移动"""
        [square.stop() for square in squares]        
        idiom.stop()                   # 成语停止
        screen.bgpic(endimage)         # 显示结束画面
        info = [ square.name + ":" + str(square.score)   for square in squares]
        info = ",".join(info)         # 连接列表每一项
        myfont = ("楷体",24,"normal")
        end_writer = Writer(0,-50,myfont,info,13000,screen)
        screen.onclick(lambda x,y:screen.bye())  # 单击屏幕关闭窗口
        

You must log in to read the rest of this article. Please log in or register as a user.