Commit 85c7a08b by BellCodeEditor

save project

parent ef8bf3a8
Showing with 25 additions and 1 deletions
...@@ -5,6 +5,18 @@ class Hero(): ...@@ -5,6 +5,18 @@ class Hero():
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
houyi=Hero("后羿",300,40) houyi=Hero("后羿",300,40)
houyi.hp350
print(houyi.hp) print(houyi.hp)
def upgrate():
houyi.level=houyi.level+1
houyi.ouyi.hp=houyi.hp+50
houyi.attack=houyi.attack+5
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
upgrate()
\ No newline at end of file
class Hero():
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
houyi=Hero("后羿",300,40)
print(houyi.hp)
print(houyi.name)
print(houyi.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