Commit a0b71638 by BellCodeEditor

auto save

parent 2721ef09
Showing with 9 additions and 9 deletions
class a: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.level=1 self.level=1
self.name=name self.name=name
def b: def upgrade(self):
self.yase.self.hp=hp+50 self.hp=self.hp+50
self.yase.self.attack=attack+4 self.attack=self.attack+4
self.yase.self.level=level+1 self.level=self.level+1
huoyi=a("后羿",240,23) huoyi=Hero("后羿",240,23)
huoyi.upgraed() huoyi.upgrade()
print("等级为:",huoyi.level) print("等级为:",huoyi.level)
print("等级为:",huoyi.hp) print("血量为:",huoyi.hp)
print("等级为:",huoyi.attack) #huoyi.hp=hp print("攻击力为:",huoyi.attack) #huoyi.hp=hp
#huoyi.attack=attack #huoyi.attack=attack
#huoyi.level=1 #huoyi.level=1
#huoyi.name=name #huoyi.name=name
......
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