用户:
编程猫开封运营中心查看:0 回复:0 评论:0 创建时间:2020-02-29T20:33:17
【作品展示】

【作品介绍】
更换游戏皮肤
【作品源代码】
import pgzrun
WIDTH = 480
HEIGHT= 600
#添加小女孩的角色
girl = Actor("co")
girl.pos=200,300
#添加头发
hair_style = ['hair_1', 'hair_2', 'hair_3', 'hair_4']
hair = Actor("hair_1")
hair.pos = 220, 220
#添加衣服
dress_style = ['dress_1', 'dress_2', 'dress_3', 'dress_4']
dress = Actor("dress_1")
dress.pos = 215, 400
#添加鞋子
shoes_style = ['shoes_1', 'shoes_2', 'shoes_3', 'shoes_4']
shoes = Actor("shoes_1")
shoes.pos = 210, 530
#切换造型
def changeStyle1(obj,styleList):
style = styleList.index(obj.image)
print(obj.image)
if style < 3:
obj.image = styleList[style+1]
else:
obj.image = styleList[0]
print(style)
#使图片显示出来
def draw():
screen.blit('background',(0,0))
girl.draw()
hair.draw()
dress.draw()
shoes.draw()
def on_mouse_down(pos):
if hair.collidepoint(pos):
changeStyle1(hair, hair_style)
pgzrun.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn