Commit 791e3a2d by BellCodeEditor

save project

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