猫史档案馆


【Python作品分享】喵换装游戏【作业帖】

用户:泯·灭泯·灭查看:0 回复:0 评论:0 创建时间:2020-06-07T15:47:45


【作品展示】

center_image

 

【作品介绍】

课堂作品(未完工)

 

【作品源代码】

import pgzrun
WIDTH=620
HEIGHT=900

g=Actor('co')
g.pos=300,350

hr_style=['hair_1','hair_2','hair_3','hair_4']
hr=Actor('hair_1')
hr.pos=317,269

dss_style = ['dress_1', 'dress_2', 'dress_3', 'dress_4']
dss=Actor('dress_1')
dss.pos=313,453

shs_style = ['shoes_1', 'shoes_2', 'shoes_3', 'shoes_4']
shs=Actor('shoes_1')
shs.pos=313,580

def draw():
    screen.blit('background',(0,0))
    g.draw()
    hr.draw()
    dss.draw()
    shs.draw()

def changestyle(obj,stylelist):
    style=stylelist.index(obj.image)
    if(style<3):
        obj.image=stylelist[style+1]
    else:
        obj.image=stylelist[0]

def on_mouse_down(pos):
    if dss.collidepoint(pos):
        changestyle(dss,dss_style)
    elif hr.collidepoint(pos):
        changestyle(hr,hr_style)
    elif shs.collidepoint(pos):
        changestyle(shs, shs_style)

pgzrun.go()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页