Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Player():
- def __init__(self, name):
- self.name = name
- self.inventory = []
- def say_name(self):
- print self.name
- def add_to_inventory(self, object):
- self.inventory += [object]
- def show_inventory(self):
- for obj in self.inventory:
- print 'You have a %s' % obj
- class World():
- def __init__(self):
- self.turn = 2
- self.day = True
- def do_turn(self):
- self.turn -= 1
- if self.turn == 0:
- self.change_status()
- def change_status(self):
- if bool(self.day) == True:
- self.day = False
- else:
- self.day = True
- self.turn = 2
- thom = Player("thom")
- thom.add_to_inventory('thingy')
- thom.show_inventory()
Add Comment
Please, Sign In to add comment