Начал писать игру(Кубик Рубика) на Ursina (Python) и столкнулся с ошибкой
Начал писать игру(Кубик Рубика) на Ursina (Python), вот код:
from ursina import *
class Game(Ursina):
def __init__(self):
super().__init__()
window.fullscreen = True
Entity(model='quad', scale=60, texture='white_cube', texture_scale=(60, 60), rotation_x=90, y=5, color=color.light_gray)
Entity(model='sphere', scale=100, texture='textures/sky0', double_sided=True)
Entity(model='models/xyz', texture='textures/xyz', scale=0.8)
EditorCamera()
camera.world_position = (0, 0, -15)
self.load_game()
def load_game(self):
pass
def input(self, key):
super().input(key)
if __name__ == 'main':
game = Game()
game.run()
А вот непонятная ошибка:
Traceback (most recent call last):
File "C:\Users\MAKSIM\PycharmProjects\rubicocubico\main.py", line 2, in <module>
class Game(Ursina):
TypeError: function() argument 'code' must be code, not str
Ответы (1 шт):
Такой подход не сработает. Класс Ursina
является @singleton
.
Если ознакомиться с содержимым модуля - можно найти такое описание класса:
The main class of Ursina. This class is a singleton, so you can only have one instance of it.
Советую ознакомиться с официальной документацией и минимальным примером: https://www.ursinaengine.org/documentation.html https://www.ursinaengine.org/introduction_tutorial.html
В ней вы сможете найти примеры работы с модулем. В отличие от "какой-то обучалки" - документация актуализируется. Возможно версия модуля в "обучалке" сильно отличается от актуальной.