猫史档案馆


【Python作品分享】王子鸣-第22课-太空站漫步【作品秀】

用户:卢江枝~洗相片定制照片书卢江枝~洗相片定制照片书查看:0 回复:0 评论:0 创建时间:2021-03-07T20:12:53


【作品展示】

center_image

 

【作品介绍】

 

【作品源代码】

#导入库
from arcade import *
import random
#我的窗口,继承父类Window
class MyWindow(Window):
    #设置
    def setup(self):
        self.space_station = Sprite('kjz.png', 0.34)
        self.space_station.center_x = 400
        self.space_station.center_y = 300

        self.codemao = Sprite('yhm.png', 0.1)
        self.codemao.center_x = 400
        self.codemao.center_y = 300

        self.codemao.change_x = random.randint(-5,5)
        self.codemao.change_y = random.randint(-5,5)


    #绘制
    def on_draw(self):
        #开始渲染
        start_render()
        #绘制精灵
        self.space_station.draw()
        self.codemao.draw()
    #等待刷新
    def on_draw(self):
        self.codemao.update()
#实例化窗口
w = MyWindow()
w.setup()
run()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页