Here is the subclass of SpriteNode
class Powerup(SpriteNode):
def init(name, duration, from_brick):
self.name = name
self.duration = duration
self.from_brick = from_brick
SpriteNode.init(self.name, position=from_brick.position)
def __setattr__(name, duration, from_brick):
SpriteNode.__setattr__(name, duration, from_brick)
It actually must display a Powerup on the screen.
Don't worry about the from_brick.position attribute in the init function, the from_brick attribute of my class must be a SpriteNode.
Notice: I have done all the indents, but they may be not displayed, don't worry.
Here is how I call the class to create a Powerup:
pup = Powerup("plf:Item_Star", 30, brickOnScreen)
The brickOnScreen variable was defined.
Gives a TypeError, that init() takes 3 arguments, but 4 were given (The error bookmark points at the line where I assign the class to the pup variable.
Thanks for your answers, programmers!