Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/336.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 获取播放器';s X和Y位置_Python_Minecraft - Fatal编程技术网

Python 获取播放器';s X和Y位置

Python 获取播放器';s X和Y位置,python,minecraft,Python,Minecraft,我想让我的Minecraft克隆版更像Minecraft,所以我想添加一个生成块的函数,我该怎么做 from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController import random --SNIP-- def Hill(): Hill_Size = random.randint(0,22) HillZ = random.randint(0, 30)

我想让我的Minecraft克隆版更像Minecraft,所以我想添加一个生成块的函数,我该怎么做

from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
import random
--SNIP--
def Hill():
    Hill_Size = random.randint(0,22)
    HillZ = random.randint(0, 30)
    HillX = random.randint(0, 30)
    for i in range(1):
        HH = 0
        HH += 1
        voxel = Voxel(position = (HillX,HH,HillZ))
        voxel = Voxel(position = (HillX+1,HH+1,HillZ+1))
        voxel = Voxel(position = (HillX+2,HH+2,HillZ+2))
--SNIP--
for z in range(30):
    for x in range(30):
        layer1 = Voxel(position = (x-15,0,z-15), texture=grass_texture)
        layer2 = Voxel(position = (x-15,-1,z-15), texture=dirt_texture)
        layer3 = Voxel(position = (x-15,-2,z-15), texture=stone_texture)
        layer4 = Voxel(position = (x-15,-3,z-15), texture=brick_texture)
Hill()       
app.run()


是否有一种方法可以找到我的球员的位置,比如
print(player.x)
,或者我可以执行
x,y=get之类的操作。player.position()

if player.x<变量:
声明
我们可以将
x
替换为
y
z
。 把这个放到更新函数中,你就可以开始了