猫史档案馆


【Python作品分享】BUG【作品秀】

用户:开朗的挠挠熊Jldk开朗的挠挠熊Jldk查看:0 回复:0 评论:0 创建时间:2021-04-13T19:55:05


【作品展示】

center_image

 

【作品介绍】

jhg

 

【作品源代码】


from arcade import*
import arcade


class MyWindow(Window):
    def setup(self):
        self.bg = Sprite('空间站.png')
        self.bg.center_x = 400
        self.bg.center_y = 300
        self.plane_list = SpriteList()
        schedule(self.create_plane, random.randint(1,5))

    def create_plane(self, time):
        num = random.randint(1, 3)
        for i in range(num):
            self.plane = Sprite('BUG猫.png', scale=0.08)
            self.plane.center_x = random.randint(0, 800)
            self.plane.center_y = random.randint(500, 600)
            self.plane.change_y = random.randint(-5, -2)
            self.plane_list.append(self.plane)

    def on_mouse_release(self, x, y, bottom, modifiers):
        hit_list = get_sprites_at_point((x, y), self.plane_list)
        for hit in hit_list:
            self.plane_list.remove(hit)

    def on_draw(self):
        start_render()
        self.bg.draw()
        self.plane_list.draw()

    def on_update(self, time):
        self.plane_list.update()


w = MyWindow()
w.setup()
run()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页