Commit b53a1665 by BellCodeEditor

save project

parent 07fc7ca2
Showing with 10 additions and 9 deletions
...@@ -5,13 +5,13 @@ class hero: ...@@ -5,13 +5,13 @@ class hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade(): def upgrade(self):
ys.level=ys.level+1 self.level=ys.level+1
ys.hp=ys.hp+50 self.hp=ys.hp+50
ys.attack=ys+10 self.attack=ys+10
ys = hero("ys",300,20) hi = hero("hi",240,25)
print("ys的初始血量为:"ys.hp) hi.upgrade()
upgarde() print("等级",hi.level)
upgarde() print("血量",hi.hp)
print("ys升级二次后血量为:"ys.hp) print("攻击",hi.attack)
\ 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