所以我刚开始使用“Ursina”引擎,我对它还是很陌生。我正在尝试使用此引擎在 Youtube 教程上制作 Minecraft 游戏。并且由于某种原因,程序不断给我错误名称“名称'render'未定义”。我不明白这是在说什么。我试图修复我的代码并浏览了代码但找不到答案。
这是我的所有代码:
from ursina import *
from ursina.prefabs.first_person_controller import FirstPersonController
Sky(texture = 'sky.jpg')
class Voxel(Button):
def __init__(self, position = (0,0,0)):
super().__init__(
model = 'cube',
texture = 'white_cube',
position = position,
color = color.white,
parent = scene,
origin_y = 0.5,
highlight_color = color.lime,
)
app = Ursina()
player = FirstPersonController()
for x in range(12):
for y in range(12):
voxel = Voxel(position = (y,0,x))
app.run()
这是代码的 Traceback:
PS C:\Users\lhnguyen1029> & "C:/Program Files (x86)/Python39-
32/python.exe" "c:/Users/lhnguyen1029/OneDrive - Mesa Public
Schools/Documents/CTE- Computer Science Principles/Ursina
practice/ursina_practice(2).py"
package_folder:
C:\Users\lhnguyen1029\AppData\Roaming\Python\Python39\site-
packages\ursina
asset_folder: c:\Users\lhnguyen1029\OneDrive - Mesa Public
Schools\Documents\CTE- Computer Science Principles\Ursina practice
screen resolution: (1366, 768)
Traceback (most recent call last):
File "c:\Users\lhnguyen1029\OneDrive - Mesa Public
Schools\Documents\CTE- Computer Science Principles\Ursina
practice\ursina_practice(2).py", line 7, in <module>
Sky(texture = 'sky.jpg')
File "C:\Users\lhnguyen1029\AppData\Roaming\Python\Python39\site-
packages\ursina\prefabs\sky.py", line 8, in __init__
parent = render,
NameError: name 'render' is not defined
PS C:\Users\lhnguyen1029>