Commit c2dcc87d by BellCodeEditor

save project

parent 6377e47c
Showing with 20 additions and 9 deletions
......@@ -4,11 +4,22 @@ class hero:
self.hp = hp
self.level = level
self.name = name
yase = hero("yase",300,20,1)
def uplevel():
yase.level = yase.level + 1
yase.hp = yase.hp + 50
yase.attack = yase.attack + 4
uplevel()
uplevel()
print("亚瑟的血量为:",yase.hp)
\ No newline at end of file
def uplevel(self):
self.level = self.level + 1
self.hp = self.hp + 50
self.attack = self.attack + 4
def printdata(self):
print(self.name,"level=",self.level)
print(self.name,"attack=",self.attack)
print(self.name,"hp=",self.hp)
yase = hero("yase",300,21,1)
houyi = hero("houyi",240,24,1)
yase.uplevel()
houyi.uplevel()
yase.printdata()
houyi.printdata()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment