""" find_in_square与爆炸效果举例1.py 本程序单击鼠标进行角色查找,采用onclick绑定的方式进行。 本程序需要sprites模块V1.469版本支持。 请用cmd命令打开管理员,输入以下命令进行更新。 pip install sprites --upgrade """ from sprites import * bug = Sprite() screen = bug.screen screen.setup(800,600) w = screen.cv bug2 = Sprite() bug2.left(90) bug3 = Sprite() bug3.right(90) bug4 = Sprite() bug4.right(180) def baozha(x,y): global running # 在x,y为中心边长为2区域内查找角色 sprite = find_in_square(x,y)[0] explode(sprite,爆炸表) sprite.hide() running = running -1 爆炸表 = ['res/explosion0.png','res/explosion1.png'] bugs = [bug,bug2,bug3,bug4] bugs[0].onclick(baozha) bugs[1].onclick(baozha) bugs[2].onclick(baozha) bugs[3].onclick(baozha) clock = Clock() running = len(bugs) while running: for bug in bugs: bug.fd(1) clock.tick(30) end = Sprite('blank') end.write("Game Over")
-
- 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 月