繁体   English   中英

如何修复体素游戏中的 python ursina 错误

[英]How do I fix python ursina error in voxel game

在我的 python 项目中,我有以下代码:代码抛出NameError: name 'render' is not defined

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

app = Ursina

class Voxel(Button):
    def __init__(self, position = (0,0,0)):
        super().__init__(
            parent = scene,
            position = position,
            model = 'cube',
            texture = 'white_cube',
            color = color.white,
            highlight_color = color.lime,
            origin_y = 0.5,
            scale = 0.5
            )

for z in range(8):
    for x in range(8):
        voxel = Voxel(position = (x,0,z))


player = FirstPersonController()

voxel = Voxel()

app.run

如何解决以下错误??>

package_folder: C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina
asset_folder: e:\Dimiland\Programiranje\Python\Visual Studio Code\Games
screen resolution: (1440, 900)
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Exception ignored in: <function Texture.__del__ at 0x00000249051B55A0>
Traceback (most recent call last):
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\texture.py", line 186, in __del__
    del self._cached_image
AttributeError: _cached_image
Traceback (most recent call last):
  File "e:\Dimiland\Programiranje\Python\Visual Studio Code\Games\Game 01.py", line 24, in <module>
    player = FirstPersonController()
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\prefabs\first_person_controller.py", line 32, in __init__
    ray = raycast(self.world_position+(0,self.height,0), self.down, ignore=(self,))
  File "C:\Users\POM\AppData\Local\Programs\Python\Python310\lib\site-packages\ursina\entity.py", line 425, in world_position
    return Vec3(self.get_position(render))
NameError: name 'render' is not defined

你忘了()

app = Ursina应该是app = Ursina()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM