I'm making a text adventure game in Python 3.4, here is the code:
class Player:
def __int__(self, name):
self.name = name
self.maxhealth = 50
self.health = self.maxhealth
self.attack = 7
def main():
print('1. Start')
print('2. Load')
print('3. Exit')
option = input('--> ')
if option == '1':
start()
elif option == '2':
pass
elif option == '3':
sys.exit()
else:
main()
def start():
print('Hello adventurer! What is your name?')
option = input('--> ')
global PlayerIG
PlayerIG = Player(option)
start1()
def start1():
print ('Name:',PlayerIG)
print ('Attack:',PlayerIG.attack)
main()
I keep getting this error everytime I run my code:
PlayerIG = Player(option)
TypeError: object() takes no parameters
I can't really wrap my head around it, please help. I want to know what I did wrong in assigning the variable from a class.
__int__to__init__.print('Name:', PlayerIG.name)