So I tried to write an terminal based RPG in order to learn OOP, so I wrote this code:
class car(object): #car is the short form of Character
def __init__(self):
self.leben = 100
self.speed = 10
self.SD = 20
def attack(self, life):
#life-= self.SD
#return life
pass
def stats(self):
print 'Leben: '
print self.leben
print 'Geschwindigkeit: '
print self.speed
print 'Schaden: '
print self.SD
class wojok(car):
def __init__(self):
super(car.__init__(self)).__init__()
self.SD = 50
C = wojok()
while True:
e = raw_input('Befehl: ')
if e == 'info':
C.stats()
elif e == 'stop':
break
Now I get the error:
TypeError: unbound method __init__() must be called with car instance as first argument(got nothing instead)
But when I try to pass an instance of car as the first argument into init I get the error:
TypeError: unbound method __init__() must be called with car instance as first argument(got instance instead)
What do I have to use as first argument?