Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- class Character(object):
- def __init__(self, name, level):
- self.name = name
- self.level = level
- self.health = int(level + 5 ** 2) # if level is'nt number this will throw
- def damage(self, attack):
- self.health -= attack
- if self.health <= 0:
- print("%s has died!" % self.name)
- else:
- print("%s has lost %i health!" % (self.name, attack))
- def attack(self):
- attack = self.level/4 * 1.5
- return attack
- vilan = Character("Megaman", 13) # :)
- hero = Character("Metroman", 20)
- hero.damage(vilan.attack())
- vilan.damage(8) # ;)
- vilan.damage(20)
- input() #wait here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement