from Walimaker import *
setup(800, 800)
def create(img, pos, scl = 0.5):
# 创建
c = Character(img)
c.goto(pos)
c.scl = scl # 属性
c.scale(c.scl)
return c
def suoxiaosuidao(c):
if c.get_mouse_clicked():
c.goto(get_mouse_pos())
if c.collide(tunnel) and c.get_mouse_clicked():
if vx > 0:
# 变大
c.scl += 0.01
if vx < 0:
# 变小
c.scl -= 0.01
c.scale(c.scl)
def zhuqingting(c):
# 当竹蜻蜓和人物接触,人物往上飞
if heli.get_mouse_clicked():
heli.goto(get_mouse_pos())
if c.collide(heli):
c.y += 5
heli.y += 5
tunnel = Character('缩小隧道.png')
tunnel.scale(0.3)
heli = Character('竹蜻蜓.png')
heli.scale(0.3)
# 哆啦A梦的创建
dora = create('哆啦A梦.png', (300,300), 0.6)
# 大雄的创建
daxiong = create('大雄.png', (0,300), 0.4)
# 胖虎的创建
panghu = create('胖虎.png', (-300,300))
while True:
vx, vy = get_mouse_rel() # 分解
# 哆啦A梦和缩小隧道的交互
suoxiaosuidao(dora)
# 大雄和缩小隧道的交互
suoxiaosuidao(daxiong)
# 胖虎和缩小隧道的交互
suoxiaosuidao(panghu)
# 哆啦A梦和竹蜻蜓的交互
zhuqingting(dora)
# 大雄和竹蜻蜓的交互
zhuqingting(daxiong)
# 胖虎和竹蜻蜓的交互
zhuqingting(panghu)
update()
缩小隧道-哆啦a梦
最新推荐文章于 2024-11-08 13:43:44 发布