Commit e9a3fa13 by BellCodeEditor

save project

parent 01ce8032
Showing with 8 additions and 4 deletions
...@@ -4,17 +4,20 @@ class Hero: ...@@ -4,17 +4,20 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('yase',300,20) """yase=Hero('yase',300,20)
hy=Hero('hy',250,23) hy=Hero('hy',250,23)
k=Hero('K',5600,199) k=Hero('K',5600,199)
print("y的属性:",yase.attack,yase.hp) print("y的属性:",yase.attack,yase.hp)
print("h的属性:",hy.attack,hy.hp) print("h的属性:",hy.attack,hy.hp)
print("k的属性:",k.attack,k.hp) print("k的属性:",k.attack,k.hp)"""
def uprrade(): def uprrade():
yase.level=yase.level+1 yase.level=yase.level+1
yase.hp=yase.hp+50 yase.hp=yase.hp+50
yase.attack=yase.attack+4 yase.attack=yase.attack+4
yase=Hero('yase',300,20)
print("yase的属性:",yase.hp)
uprrade() uprrade()
uprrade() uprrade()
print("调用两次后等级为",yase.level)
print("调用两次后防御力为",yase.hp)
print("调用两次后攻击力为",yase.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