"""
密室寻宝.py
"""
from sprites import *
screen = Screen()
screen.bgcolor('black')
screen.setup(480,360)
screen.title('密室寻宝')
cv = screen.cv
h = Sprite('blank')
h.saybordercolor('cyan')
h.saycolor('light green')
h.sayfontstyle(('楷体',22,'normal'))
h.say('据说密室尽头有宝藏')
h.say('上下左右方向箭头\n操作我先去拿钥匙',delay=4)
screen.bgcolor('light cyan')
def config_capstyle():
lid = d.currentLineItem
cv.itemconfig(lid,capstyle=TK.BUTT,
joinstyle=TK.MITER)
# 画的红色的墙是不能碰的
d = Sprite('blank')
d.pensize(20)
d.color("#FF0000")
config_capstyle()
d.goto(-230,180)
d.down()
d.addy(-100)
d.up()
d.pensize(40)
config_capstyle()
d.goto(0,180)
d.down()
d.addy(-150)
d.up()
config_capstyle()
d.goto(120,180)
d.down()
d.addy(-120)
d.up()
d.pensize(20)
config_capstyle()
d.goto(-120,80)
d.down()
d.addy(-180)
d.addx(360)
d.up()
sp1 = Sprite('res/sword.png',pos=(-220,-120))
def sp1_rotate():
sp1.lt(10)
screen.ontimer(sp1_rotate,100)
sp1_rotate()
sp2 = Sprite('res/egg.png',pos=(120,-50))
def sp2_rotate():
sp2.rt(10)
screen.ontimer(sp2_rotate,100)
sp2_rotate()
sp3 = Sprite(['res/bat1.png','res/bat2.png'],pos=(0,-50))
sp3.scale(0.2)
sp3.rotatemode(2)
sp3.right(90)
def sp3_move():
sp3.fd(2)
if sp3.find_overlapping():
sp3.right(180)
sp3.nextshape()
screen.ontimer(sp3_move,100)
sp3_move()
key = Sprite('res/key.png',pos=(200,160))
key.scale(0.5)
player = Sprite('res/mask0.png',pos=(220,-140))
player.scale(0.3)
leftkey = Key('Left') # 新建左方向箭头
rightkey = Key('Right') # 新建右方向箭头
upkey = Key('Up') # 新建上方向箭头
downkey = Key('Down') # 新建下方向箭头
screen.listen() # 监听屏幕按键
clock = Clock()
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)
-
- 2026 年 3 月
- 2026 年 2 月
- 2026 年 1 月
- 2025 年 12 月
- 2025 年 11 月
- 2025 年 10 月
- 2025 年 9 月
- 2025 年 6 月
- 2025 年 5 月
- 2025 年 3 月
- 2025 年 2 月
- 2025 年 1 月
- 2024 年 12 月
- 2024 年 8 月
- 2024 年 6 月
- 2024 年 5 月
- 2024 年 4 月
- 2024 年 3 月
- 2024 年 2 月
- 2023 年 11 月
- 2023 年 9 月
- 2023 年 6 月
- 2023 年 5 月
- 2023 年 4 月
- 2023 年 3 月
- 2023 年 2 月
- 2023 年 1 月
- 2022 年 12 月
- 2022 年 11 月
- 2022 年 10 月
- 2022 年 9 月
- 2022 年 8 月
- 2022 年 7 月
- 2022 年 6 月
- 2022 年 5 月
- 2022 年 4 月
- 2022 年 3 月
- 2022 年 2 月
- 2022 年 1 月
- 2021 年 12 月
- 2021 年 11 月
- 2021 年 10 月
- 2021 年 9 月
- 2021 年 8 月
- 2021 年 7 月
- 2021 年 6 月
- 2021 年 5 月
- 2021 年 4 月
- 2021 年 3 月
- 2021 年 2 月
- 2021 年 1 月
- 2020 年 12 月
- 2020 年 11 月
- 2020 年 10 月
- 2020 年 9 月
- 2020 年 8 月
- 2020 年 7 月
- 2020 年 6 月
- 2020 年 5 月
- 2020 年 4 月
- 2020 年 3 月
- 2020 年 2 月
- 2020 年 1 月
- 2019 年 12 月
- 2019 年 11 月
- 2019 年 10 月
- 2019 年 9 月
- 2019 年 8 月
- 2019 年 7 月
- 2019 年 6 月
- 2019 年 5 月
- 2019 年 4 月
- 2019 年 3 月
- 2019 年 2 月
- 2018 年 3 月
- 2018 年 1 月
- 2017 年 9 月
- 2017 年 5 月
- 2017 年 1 月

