猫史档案馆


【Python作品分享】第26课-创作作品-豆文谦

用户:内向的暴风雀_py5内向的暴风雀_py5查看:0 回复:1 评论:0 创建时间:2021-09-21T13:31:01


【作品展示】

center_image

 

【作品介绍】

。。。

 

【作品源代码】

from arcade import *
import random


class My_window(Window):
    def __init__(self):
        super().__init__(800, 600, '太空遨游')

        self.fire = Sprite('fire1.png', scale=1)
        self.fire.position = 300, 300
        pic = load_texture('fire2.png')
        self.fire.append_texture(pic)
        self.codemao = Sprite('codemao.png')
        self.codemao.position = 400,300


    def on_mouse_press(self, x, y, button, modifiers):
        self.fire.set_texture(0)
        
        self.fire.change_x = 0

    def on_mouse_release(self, x, y, button, modifiers):
        
        self.fire.set_texture(1)
        self.fire.change_x = 2


    def border(self):
        if self.fire.left >= 900:
            self.fire.left = 300

    def on_draw(self):
        start_render()
        
        self.codemao.draw()
        self.fire.draw()
    def on_update(self, time):

        self.fire.update()
        self.codemao.update()
        
        self.border()


w = My_window()
run()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
冷静的象牙螺vtsJ冷静的象牙螺vtsJ

这是怎么发布的?

点赞0


评论