import sfml
class BaseSprite(sfml.Sprite):
def __init__(self, texture, arg1, arg2, arg3, rectangle=None):
super(sfml.Sprite, self).__init__(texture, rectangle)
self.__arg1 = arg1
self.__arg2 = arg2
self.__arg3 = arg3
# ...
# Later, in other file...
import sfml
import media
from spritefactory import BaseSprite
from scenefactory import BaseScene
class Testsprite(BaseSprite):
# second time inheritance
def __init__(self, texture, arg1, arg2, arg3, rectangle=None):
BaseSprite.__init__(texture, arg1, arg2, arg3, rectangle)
self.setsomething(0)
class Scenetest(BaseScene):
def __init__(self, scenemanager):
BaseScene.__init__(self, scenemanager)
self.loadmap("some/map.tmx")
self.spritetexture = media.loadimg("some/sprite/sheet.png", False) # returns a Texture not an Image
self.__sprite = {"mai": Test(self.spritetexture, 0, 1, 3)}
# a bunch of code...
Hello! The code above is a less-detailed version of my actual source code. I'm having a nightmare trying to inheritance BaseSprite one more time. When I run the app, an awkward error shows up.
Traceback (most recent call last):
File "main.py", line 8, in <module>
escena = escena_2.Maitest(director)
File "/home/jorge/coders/desarrollo/thomas-aquinas/scenes/escena_2.py", line 22, in __init__
"sprites/others/Mai Shiranui "
File "graphics.pyx", line 1365, in sfml.graphics.Sprite.__cinit__ (src/sfml/graphics.cpp:23985)
TypeError: __cinit__() takes at most 2 positional arguments (4 given)
and if I tend to pass just one argument (i.e: the texture for the sprite) the exception change just a little:
Traceback (most recent call last):
File "main.py", line 8, in <module>
escena = escena_2.Maitest(director)
File "/home/jorge/coders/desarrollo/thomas-aquinas/scenes/escena_2.py", line 21, in __init__
self.__sprite = {"mai": Mai(self.maitext)}#, 0, self.scenemanager.window,
TypeError: __init__() takes exactly 5 arguments (2 given)
and if I don't pass any arguments at all, it changes again:
Traceback (most recent call last):
File "main.py", line 8, in <module>
escena = escena_2.Maitest(director)
File "/home/jorge/coders/desarrollo/thomas-aquinas/scenes/escena_2.py", line 21, in __init__
self.__sprite = {"mai": Mai()}#self.maitext), 0, self.scenemanager.window,
File "graphics.pyx", line 1365, in sfml.graphics.Sprite.__cinit__ (src/sfml/graphics.cpp:23985)
TypeError: __cinit__() takes at least 1 positional argument (0 given)
For God's sake, somebody help me!! D':
cheers!