Commit 891e124f by BellCodeEditor

save project

parent d3d259e5
class Hero:
def __init__(self):
self.level = 1
self.hp= 100
self.attack= 600 # attack:攻击
yase = Hero()
print("Henry的血量值为:",yase.hp)
print("Henry的攻击力为:",yase.attack)
\ No newline at end of file
......@@ -2,6 +2,6 @@ class Hero:
def __init__(self):
self.hp=1500
self.at=120
super=Hero
super=Hero()
print(super.hp)
print(super.at)
\ No newline at end of file
class Henry:
power=120
health=1500
power=900
health=750
class Super:
power=200
health=1000
......
class Hero:
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp=hp
self.attack=attack
noob = Hero("Noob",500,30)
henry = Hero("Henry",50,300)
print("noob=hp:",noob.hp)
print("noob=attack:",noob.attack)
print("henry=hp:",henry.hp)
print("henry=attack:",henry.attack)
\ 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
yase = Hero("yase",300,20)
def upgrad():
yase.level=yase.level+1
yase.hp=yase.hp+50
yase.attack=yase.attack+4
print(yase.hp)
upgrad()
upgrad()
print(yase.hp)
\ No newline at end of file
class Hero:
def __init__(self):
self.level = 1
self.hp= 300
self.attack= 20 # attack:攻击
yase = Hero()
print("yase的血量值为:",yase.hp)
print("yase的攻击力为:",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