Class Object not working as expected in Ursina

Question:

I have a class named startPlatform in Python. I am using the ursina engine. When I call it, it gives me an error:

Traceback (most recent call last):

File "C:/Users/eshan/OneDrive/Desktop/ursina-platformer-maker/main.py", line 29, in <module>`
    StartPlatform(position = (10, 5, 8))
  File "C:/Users/eshan/OneDrive/Desktop/ursina-platformer-maker/main.py", line 17, in __init__
    super().__init__(
TypeError: object.__init__() takes exactly one argument (the instance to initialize)

The argument are correct, and I don’t know what’s happening. Here’s my Code:

from ursina import *
from ursina.prefabs.sky import Sky
from ursina.shaders import basic_lighting_shader

app = Ursina()
editor = EditorCamera()

def input(key):
    if held_keys["q"]:
        quit()

class StartPlatform():
    def __init__(self, position = (0, 0, 0)):
        super().__init__(
            parent = scene,
            model = "cube",
            position = position,
            scale = (5, 2, 6),
            collider = "mesh",
            shader = basic_lighting_shader,
            texture = "white_cube",
            color = color.lime
        )

Sky()
StartPlatform(position = (10, 5, 8))
app.run()
Asked By: DonYeet46

||

Answers:

StartPlatform does not inherit Entity, which I assume is what you want it to be.

class StartPlatform():

Should be:

class StartPlatform(Entity):
Answered By: pokepetter
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.