Commit 791e3a2d by BellCodeEditor

save project

parent 93cb6339
Showing with 14 additions and 12 deletions
class Haro:
def __init__(self):
self.hp=300
self.attack=20
def __init__(self,name,hp,attack):
self.level=1
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.hp=self.hp+50
self.attack=self.attack+4
self.level=self.level+1
pipy=Haro
print("pipy的血量值为:",yase.hp)
print("pipy的攻击力为:",yase.attack)
def up():
self.hp=300+50
self.attack=20+4
self.level=1+1
up()
up()
\ No newline at end of file
print("pipy的血量值为:",pipy.hp)
upgrade()
upgrade()
print("pipy的攻击力为:",pipy.attack)
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