猫史档案馆


【Python作品分享】mine【求助帖】

用户:龙飞龙龙飞龙查看:0 回复:1 评论:0 创建时间:2023-03-03T17:44:47


【作品展示】

center_image

 

【作品介绍】

......

 

【作品源代码】

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController


class Block(Button):
    def __init__(self, position=(0, 0, 0)):
        super().__init__(
            parent=scene,
            position=position,
            model='cube',
            orgin_y=0.5,
            texture='white_cube',
            color=color.color(0,0,random.uniform(0.9,1)),
            highlight_color=color.green
        )

    def input(self,key):
        if self.hovered:
            if key == 'left mouse down':
                block = Block(position = self.position+mouse.normal)
            if key == 'right mouse down':
                destroy(self)

app = Ursina()

for z in range(30):
    for x in range(30):
            block = Block(position=(x, 0, z))

player = FirstPersonController()        

app.run()


 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
追梦ez追梦ez

?。

点赞0


评论