用户:五年七班郝睿茗查看:0 回复:0 评论:0 创建时间:2023-06-21T19:44:37
【作品展示】

【作品介绍】
minecraft
【作品源代码】
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
from perlin_noise import PerlinNoise
add=Ursina()
sky_texture = load_texture('屏幕截图 2023-05-19 215559.png')
def input(key):
if key == 'q':
quit()
class Block(Button):
def __init__(self, position=(0, 0, 0)):
super().__init__(
parent=scene,
position=position,
model='cube',
origin_y=0.5,
texture='white_cube',
color=color.color(0, 0, random.uniform(0.9, 1)),
)
def input(self, key):
if self.hovered:
if key == 'right mouse down':
block = Block(position=self.position+mouse.normal)
if key == 'left mouse down':
destroy(self)
class sky(Entity):
def __init__(self):
super().__init__(
parent=scene,
model='sphere',
texture=sky_texture,
scale=300,
double_sided=True
)
noice=PerlinNoise(octaves=3,seed=4545465喵5435147喵35353536548576)
scale=24
FirstPersonController()
for z in range(50):
for x in range(50):
block = Block(position=(x,0,z))
block.y= noice([x/scale,z/scale])*8
sky=sky()
add.run()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn