猫史档案馆


【Python作品分享】MC

用户:保守的星能猫hPxX保守的星能猫hPxX查看:0 回复:1 评论:0 创建时间:2021-12-31T18:12:23


【作品展示】

center_image

 

【作品介绍】

MC

 

【作品源代码】

l=0
import time
from ursina.prefabs.first_person_controller import FirstPersonController# 开启3D引擎
from ursina import *  # 开启3D引擎
def input(key):#退出,放置,清除
    if key=="escape":
        quit()
    for box in boxes:
        if box.hovered:
            if key=="right mouse down":
                new=Button(model="cube",
                           color=color.white,
                           position=box.position + mouse.normal,
                           texture=("QQ截图20211.PNG"),
                           parent=scene,
                           origin_y=0.5)
                boxes.append(new)
            if key=="left mouse down":
                l=0.95
                boxes.remove(box)
                destroy(box)
                time.sleep(0.1)
                l=0
            if key == "left mouse down":
                l = 0.95
                time.sleep(0.1)
                l = 0


app = Ursina()
Sky()#创建天空
boxes=[]
player = FirstPersonController()  # 创建玩家
for i in range(5):
    for n in range(25):  # 生成地形
        for k in range(25):
            box=Button(model="cube",
                       color=color.white,
                       position=(k ,-i , n),
                       texture=("QQ截图20211.PNG"),
                       parent=scene,
                       origin_y=0.5)
            boxes.append(box)
scale=Entity(model="cube",#创建手
             color=color.black,
             position=(0.5 ,-0.6),
             texture=("QQ截图2.PNG"),
             rotation=(-35, -30, -5),
             parent=camera.ui,
             scale=(0.01,0.01,0.9)
)
scale = Entity(model="cube",  # 创建手
               color=color.black,
               position=(0.56, -0.7),
               texture=("QQ截图2.PNG"),
               rotation=(-35, -30, -5),
               parent=camera.ui,
               scale=(0.027, 0.027,1.1)
               )
scale = Entity(model="cube",  # 创建手
               color=color.red,
               position=(0.43, -0.5),
               texture=("QQ截图2.PNG"),
               rotation=(-35, -30, -5),
               parent=camera.ui,
               scale=(0.0055, 0.0055, l)
               )
scale = Entity(model="cube",  # 创建手
               color=color.black,
               position=(0.43, -0.5),
               texture=("QQ截图2.PNG"),
               rotation=(-35, -30, -5),
               parent=camera.ui,
               scale=(0.0055, 0.0055,0.9)
               )
app.run()

 

【提示】

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

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
精疲力劼精疲力劼

点赞0


评论